angular-docs-cn/packages/compiler-cli/test/ngtsc
Alex Rickabaugh ed1db40322 fix(ivy): use 'typeof' and 'never' for type metadata (#24862)
Previously ngtsc would use a tuple of class types for listing metadata
in .d.ts files. For example, an @NgModule's declarations might be
represented with the type:

[NgIf, NgForOf, NgClass]

If the module had no declarations, an empty tuple [] would be produced.

This has two problems.

1. If the class type has generic type parameters, TypeScript will
complain that they're not provided.

2. The empty tuple type is not actually legal.

This commit addresses both problems.

1. Class types are now represented using the `typeof` operator, so the
above declarations would be represented as:

[typeof NgIf, typeof NgForOf, typeof NgClass].

Since typeof operates on a value, it doesn't require generic type
arguments.

2. Instead of an empty tuple, `never` is used to indicate no metadata.

PR Close #24862
2018-07-20 11:48:36 -07:00
..
fake_core feat(ivy): support host bindings in ngtsc (#24862) 2018-07-20 11:48:36 -07:00
BUILD.bazel test: switch to ts_web_test_suite (#23859) 2018-05-15 11:40:56 -07:00
ngtsc_spec.ts fix(ivy): use 'typeof' and 'never' for type metadata (#24862) 2018-07-20 11:48:36 -07:00