feat(ngcc): migrate services that are missing @Injectable()
(#33362)
A class that is provided as Angular service is required to have an `@Injectable()` decorator so that the compiler generates its injectable definition for the runtime. Applications are automatically migrated using the "missing-injectable" schematic, however libraries built for older version of Angular may not yet satisfy this requirement. This commit ports the "missing-injectable" schematic to a migration that is ran when ngcc is processing a library. This ensures that any service that is provided from an NgModule or Directive/Component will have an `@Injectable()` decorator. PR Close #33362
This commit is contained in:
@ -42,4 +42,20 @@ export interface MigrationHost {
|
||||
* @param decorator the decorator to inject.
|
||||
*/
|
||||
injectSyntheticDecorator(clazz: ClassDeclaration, decorator: Decorator): void;
|
||||
|
||||
/**
|
||||
* Retrieves all decorators that are associated with the class, including synthetic decorators
|
||||
* that have been injected before.
|
||||
* @param clazz the class for which all decorators are retrieved.
|
||||
* @returns the list of the decorators, or null if the class was not decorated.
|
||||
*/
|
||||
getAllDecorators(clazz: ClassDeclaration): Decorator[]|null;
|
||||
|
||||
/**
|
||||
* Determines whether the provided class in within scope of the entry-point that is currently
|
||||
* being compiled.
|
||||
* @param clazz the class for which to determine whether it is within the current entry-point.
|
||||
* @returns true if the file is part of the compiled entry-point, false otherwise.
|
||||
*/
|
||||
isInScope(clazz: ClassDeclaration): boolean;
|
||||
}
|
||||
|
Reference in New Issue
Block a user