angular-cn/integration/language_service_plugin
Alex Rickabaugh 95c729f5d1 build: typescript 3.8 support (#35864)
This commit adds support in the Angular monorepo and in the Angular
compiler(s) for TypeScript 3.8. All packages can now compile with
TS 3.8.

For most of the repo, only a handful few typings adjustments were needed:

* TS 3.8 has a new `CustomElementConstructor` DOM type, which enforces a
  zero-argument constructor. The `NgElementConstructor` type previously
  declared a required `injector` argument despite the fact that its
  implementation allowed `injector` to be optional. The interface type was
  updated to reflect the optionality of the argument.
* Certain error messages were changed, and expectations in tests were
  updated as a result.
* tsserver (part of language server) now returns performance information in
  responses, so test expectations were changed to only assert on the actual
  body content of responses.

For compiler-cli and schematics (which use the TypeScript AST) a major
breaking change was the introduction of the export form:

```typescript
export * as foo from 'bar';
```

This is a `ts.NamespaceExport`, and the `exportClause` of a
`ts.ExportDeclaration` can now take this type as well as `ts.NamedExports`.
This broke a lot of places where `exportClause` was assumed to be
`ts.NamedExports`.

For the most part these breakages were in cases where it is not necessary
to handle the new `ts.NamedExports` anyway. ngtsc's design uses the
`ts.TypeChecker` APIs to understand syntax and so automatically supports the
new form of exports.

The View Engine compiler on the other hand extracts TS structures into
metadata.json files, and that format was not designed for namespaced
exports. As a result it will take a nontrivial amount of work if we want to
support such exports in View Engine. For now, these new exports are not
accounted for in metadata.json, and so using them in "folded" Angular
expressions will result in errors (probably claiming that the referenced
exported namespace doesn't exist).

Care was taken to only use TS APIs which are present in 3.7/3.6, as Angular
needs to remain compatible with these for the time being.

This commit does not update angular.io.

PR Close #35864
2020-03-10 17:51:20 -04:00
..
goldens feat(language-service): Append symbol type to hover tooltip (#34515) 2019-12-20 14:40:04 -08:00
project feat(language-service): add definitions for styleUrls (#32464) 2019-09-09 16:04:14 -04:00
.gitignore test(language-service): Improve integration test (#28168) 2019-01-17 14:11:28 -08:00
README.md feat(language-service): add script to rebuild, refresh Angular dist (#32515) 2019-09-06 18:28:06 -04:00
generate.ts test(language-service): Improve integration test (#28168) 2019-01-17 14:11:28 -08:00
matcher.ts build: typescript 3.8 support (#35864) 2020-03-10 17:51:20 -04:00
package.json build: move build scripts to dedicated directory (#35780) 2020-03-04 08:35:26 -08:00
test.ts feat(language-service): add definitions for styleUrls (#32464) 2019-09-09 16:04:14 -04:00
tsclient.ts feat: typescript 3.6 support (#32946) 2019-10-18 13:15:16 -04:00
tsconfig.json build: remove vendored Babel typings (#33226) 2019-10-17 18:45:52 -04:00
yarn.lock build: update lockfiles for integration projects (#33968) 2019-11-26 16:08:32 -08:00

README.md

Angular Language Service Test

This directory is an integration test for @angular/language-service to ensure that the language service works correctly as a tsserver plugin.

To use the tests:

  • Use yarn install to install all dependencies in this directory and in the Angular repo root directory.
  • Build an Angular distribution with yarn build-dist. This needs to be done after changes to Angular, but not after changes to integration tests. This is an expensive build.
  • In this directory, run the integration tests with yarn test.

Update golden files

If the expected output needs to be updated, run yarn golden my-golden.json, replacing my-golden.json with the golden file to be updated. Do not qualify the file with a directory path. See generate.ts for more information.

Adding a new fixture

Currently there is no automated way to produce a new fixture. The way the current fixtures were created was to hack a version of tsserver.js to write the commands from VSCode to a file while performing the operation to be tested. I also hand modified the input to remove superfluous request.

Once a new fixture is created:

  1. Add the fixture name to goldens/
  2. Run yarn golden my-golden.json, replacing my-golden.json with the new fixture name, to produce the expected output files.
  3. Hand validate that the expected output is reasonable.