1 | /// <amd-module name="@angular/compiler-cli/ngcc/src/migrations/missing_injectable_migration" />
|
---|
2 | /**
|
---|
3 | * @license
|
---|
4 | * Copyright Google LLC All Rights Reserved.
|
---|
5 | *
|
---|
6 | * Use of this source code is governed by an MIT-style license that can be
|
---|
7 | * found in the LICENSE file at https://angular.io/license
|
---|
8 | */
|
---|
9 | import * as ts from 'typescript';
|
---|
10 | import { ClassDeclaration, Decorator } from '../../../src/ngtsc/reflection';
|
---|
11 | import { Migration, MigrationHost } from './migration';
|
---|
12 | /**
|
---|
13 | * Ensures that classes that are provided as an Angular service in either `NgModule.providers` or
|
---|
14 | * `Directive.providers`/`Component.viewProviders` are decorated with one of the `@Injectable`,
|
---|
15 | * `@Directive`, `@Component` or `@Pipe` decorators, adding an `@Injectable()` decorator when none
|
---|
16 | * are present.
|
---|
17 | *
|
---|
18 | * At least one decorator is now mandatory, as otherwise the compiler would not compile an
|
---|
19 | * injectable definition for the service. This is unlike View Engine, where having just an unrelated
|
---|
20 | * decorator may have been sufficient for the service to become injectable.
|
---|
21 | *
|
---|
22 | * In essence, this migration operates on classes that are themselves an NgModule, Directive or
|
---|
23 | * Component. Their metadata is statically evaluated so that their "providers"/"viewProviders"
|
---|
24 | * properties can be analyzed. For any provider that refers to an undecorated class, the class will
|
---|
25 | * be migrated to have an `@Injectable()` decorator.
|
---|
26 | *
|
---|
27 | * This implementation mirrors the "missing-injectable" schematic.
|
---|
28 | */
|
---|
29 | export declare class MissingInjectableMigration implements Migration {
|
---|
30 | apply(clazz: ClassDeclaration, host: MigrationHost): ts.Diagnostic | null;
|
---|
31 | }
|
---|
32 | /**
|
---|
33 | * Determines the original name of a decorator if it is from '@angular/core'. For other decorators,
|
---|
34 | * null is returned.
|
---|
35 | */
|
---|
36 | export declare function getAngularCoreDecoratorName(decorator: Decorator): string | null;
|
---|