Files
angular/packages/compiler/test
Matthew Beck 18edb1b0be fix(compiler): guard unverified ctor parameter types in class metadata
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.

(cherry picked from commit c92ed082ea)
2026-09-22 16:05:39 +00:00
..
2026-02-09 12:15:57 -08:00