cf37c003ff
Angular View Engine uses global knowledge to compile the following code: ```typescript export class Base { constructor(private vcr: ViewContainerRef) {} } @Directive({...}) export class Dir extends Base { // constructor inherited from base } ``` Here, `Dir` extends `Base` and inherits its constructor. To create a `Dir` the arguments to this inherited constructor must be obtained via dependency injection. View Engine is able to generate a correct factory for `Dir` to do this because via metadata it knows the arguments of `Base`'s constructor, even if `Base` is declared in a different library. In Ivy, DI is entirely a runtime concept. Currently `Dir` is compiled with an ngDirectiveDef field that delegates its factory to `getInheritedFactory`. This looks for some kind of factory function on `Base`, which comes up empty. This case looks identical to an inheritance chain with no constructors, which works today in Ivy. Both of these cases will now become an error in this commit. If a decorated class inherits from an undecorated base class, a diagnostic is produced informing the user of the need to either explicitly declare a constructor or to decorate the base class. PR Close #34460 |
||
---|---|---|
.. | ||
diagnostics | ||
metadata | ||
ngtsc | ||
transformers | ||
extract_i18n.ts | ||
language_services.ts | ||
main.ts | ||
perform_compile.ts | ||
perform_watch.ts | ||
tooling.ts | ||
typescript_support.ts | ||
version.ts |