UNPKG

1.63 kBTypeScriptView Raw
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/compiler-cli/src/transformers/downlevel_decorators_transform" />
9import * as ts from 'typescript';
10import { ReflectionHost } from '../ngtsc/reflection';
11/**
12 * Gets a transformer for downleveling Angular decorators.
13 * @param typeChecker Reference to the program's type checker.
14 * @param host Reflection host that is used for determining decorators.
15 * @param diagnostics List which will be populated with diagnostics if any.
16 * @param isCore Whether the current TypeScript program is for the `@angular/core` package.
17 * @param isClosureCompilerEnabled Whether closure annotations need to be added where needed.
18 * @param skipClassDecorators Whether class decorators should be skipped from downleveling.
19 * This is useful for JIT mode where class decorators should be preserved as they could rely
20 * on immediate execution. e.g. downleveling `@Injectable` means that the injectable factory
21 * is not created, and injecting the token will not work. If this decorator would not be
22 * downleveled, the `Injectable` decorator will execute immediately on file load, and
23 * Angular will generate the corresponding injectable factory.
24 */
25export declare function getDownlevelDecoratorsTransform(typeChecker: ts.TypeChecker, host: ReflectionHost, diagnostics: ts.Diagnostic[], isCore: boolean, isClosureCompilerEnabled: boolean, skipClassDecorators: boolean): ts.TransformerFactory<ts.SourceFile>;