mirror of
https://github.com/angular/angular.git
synced 2026-11-23 07:05:14 -05:00
In local compilation mode the compiler can emit a reference to a symbol that it was not able to prove has a value at runtime, because deciding that can require information from other files. The generated factory already guards those references with a `@ts-ignore`, but the `ctorParameters` callback passed to `setClassMetadata` does not, so the same symbol ends up guarded in one place and unguarded a few lines later in the same file. Type checking the generated code then fails on the unguarded reference. Constructor parameters are now handed to `@angular/compiler` in a structured form rather than as an already-built callback, which lets the compiler attach a suppression directly to the `type` property assignment of each parameter that needs one. Only references that reflection could not verify are guarded: full compilation resolves every reference, so its output is unchanged, and partial declarations are published as JavaScript and never type checked, so they are never guarded either. Producers that build the callback themselves keep passing an expression, which is emitted untouched.