mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
The template type-checker has to emit type constructors for the directives that are used in a template, where a type constructor's declaration has to mirror the type parameter constraints as they were originally declared. Therefore, the compiler analyzes whether a type parameter constraint can be recreated, e.g. by generating imports for any type references. Some type references cannot be recreated, in which case the compiler has to fall back to a strategy where the type constructor is created inline in the original source file (which comes with a performance penalty). There used to be an issue for type references to namespaced declarations. The compiler is unable to emit such references such that an inline type constructor should be used as fallback, but this did not happen. This caused the attempt to emit the type reference to fail, as the namespaced declaration cannot be located by the reference emitters. This commit fixes the issue by using a stricter check to determine if a type parameter requires an inline type constructor. The TypeScript reflection host's `isStaticallyExported` logic was expanded to work for any declaration instead of just classes, as e.g. type declarations can also be referenced in a type parameter constraint. Closes #43383 PR Close #43511 |
||
|---|---|---|
| .. | ||
| src | ||
| test | ||
| BUILD.bazel | ||
| index.ts | ||
| main-ivy-ngcc.ts | ||
| main-ngcc.ts | ||
| README.md | ||
Angular Compatibility Compiler (ngcc)
This compiler will convert node_modules compiled with ngc, into node_modules which
appear to have been compiled with ngtsc.
This conversion will allow such "legacy" packages to be used by the Ivy rendering engine.
Building
The project is built using Bazel:
yarn bazel build //packages/compiler-cli/ngcc
Unit Testing
The unit tests are built and run using Bazel:
yarn bazel test //packages/compiler-cli/ngcc/test
Integration Testing
There are tests that check the behavior of the overall executable:
yarn bazel test //packages/compiler-cli/ngcc/test:integration