diff --git a/packages/compiler-cli/src/ngcc/src/host/fesm2015_host.ts b/packages/compiler-cli/src/ngcc/src/host/fesm2015_host.ts index 453d65b2cb..87ea6c8f4d 100644 --- a/packages/compiler-cli/src/ngcc/src/host/fesm2015_host.ts +++ b/packages/compiler-cli/src/ngcc/src/host/fesm2015_host.ts @@ -572,6 +572,7 @@ export class Fesm2015ReflectionHost extends TypeScriptReflectionHost implements const decoratorIdentifier = decoratorExpression; return { name: decoratorIdentifier.text, + identifier: decoratorIdentifier, import: this.getImportOfIdentifier(decoratorIdentifier), node: call, args: Array.from(call.arguments) @@ -634,6 +635,7 @@ export class Fesm2015ReflectionHost extends TypeScriptReflectionHost implements if (typeIdentifier && ts.isIdentifier(typeIdentifier)) { decorators.push({ name: typeIdentifier.text, + identifier: typeIdentifier, import: this.getImportOfIdentifier(typeIdentifier), node, args: getDecoratorArgs(node), }); diff --git a/packages/compiler-cli/src/ngtsc/host/src/reflection.ts b/packages/compiler-cli/src/ngtsc/host/src/reflection.ts index 37c6e8d5e5..49722ed448 100644 --- a/packages/compiler-cli/src/ngtsc/host/src/reflection.ts +++ b/packages/compiler-cli/src/ngtsc/host/src/reflection.ts @@ -20,6 +20,11 @@ export interface Decorator { */ name: string; + /** + * Identifier which refers to the decorator in source. + */ + identifier: ts.Identifier; + /** * `Import` by which the decorator was brought into the module in which it was invoked, or `null` * if the decorator was declared in the same module and not imported. diff --git a/packages/compiler-cli/src/ngtsc/metadata/src/reflector.ts b/packages/compiler-cli/src/ngtsc/metadata/src/reflector.ts index 782ae5e40c..48472794ec 100644 --- a/packages/compiler-cli/src/ngtsc/metadata/src/reflector.ts +++ b/packages/compiler-cli/src/ngtsc/metadata/src/reflector.ts @@ -245,6 +245,7 @@ export class TypeScriptReflectionHost implements ReflectionHost { return { name: decoratorExpr.text, + identifier: decoratorExpr, import: importDecl, node, args, }; }