1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | /// <amd-module name="@angular/core/schematics/migrations/module-with-providers/transform" />
|
---|
9 | import { UpdateRecorder } from '@angular-devkit/schematics';
|
---|
10 | import { ResolvedValueMap } from '@angular/compiler-cli/src/ngtsc/partial_evaluator';
|
---|
11 | import * as ts from 'typescript';
|
---|
12 | import { ResolvedNgModule } from './collector';
|
---|
13 | export interface AnalysisFailure {
|
---|
14 | node: ts.Node;
|
---|
15 | message: string;
|
---|
16 | }
|
---|
17 | export declare class ModuleWithProvidersTransform {
|
---|
18 | private typeChecker;
|
---|
19 | private getUpdateRecorder;
|
---|
20 | private printer;
|
---|
21 | private partialEvaluator;
|
---|
22 | constructor(typeChecker: ts.TypeChecker, getUpdateRecorder: (sf: ts.SourceFile) => UpdateRecorder);
|
---|
23 | /** Migrates a given NgModule by walking through the referenced providers and static methods. */
|
---|
24 | migrateModule(module: ResolvedNgModule): AnalysisFailure[];
|
---|
25 | /** Migrates a ModuleWithProviders type definition that has no explicit generic type */
|
---|
26 | migrateType(type: ts.TypeReferenceNode): AnalysisFailure[];
|
---|
27 | /** Add a given generic to a type reference node */
|
---|
28 | private _addGenericToTypeReference;
|
---|
29 | /**
|
---|
30 | * Migrates a given static method if its ModuleWithProviders does not provide
|
---|
31 | * a generic type.
|
---|
32 | */
|
---|
33 | private _updateStaticMethodType;
|
---|
34 | /** Whether the resolved value map represents a ModuleWithProviders object */
|
---|
35 | isModuleWithProvidersType(value: ResolvedValueMap): boolean;
|
---|
36 | /**
|
---|
37 | * Determine the generic type of a suspected ModuleWithProviders return type and add it
|
---|
38 | * explicitly
|
---|
39 | */
|
---|
40 | private _migrateStaticNgModuleMethod;
|
---|
41 | /** Evaluate and return the ngModule type from an expression */
|
---|
42 | private _getNgModuleTypeOfExpression;
|
---|
43 | /**
|
---|
44 | * Visits a given object literal expression to determine the ngModule type. If the expression
|
---|
45 | * cannot be resolved, add a TODO to alert the user.
|
---|
46 | */
|
---|
47 | private _getTypeOfResolvedValue;
|
---|
48 | private _updateNode;
|
---|
49 | }
|
---|