diff --git a/packages/compiler-cli/src/ngtsc/annotations/src/ng_module.ts b/packages/compiler-cli/src/ngtsc/annotations/src/ng_module.ts index 115a9e7361..7da852a814 100644 --- a/packages/compiler-cli/src/ngtsc/annotations/src/ng_module.ts +++ b/packages/compiler-cli/src/ngtsc/annotations/src/ng_module.ts @@ -540,8 +540,7 @@ export class NgModuleDecoratorHandler implements } // Verify that a `ts.Declaration` reference is a `ClassDeclaration` reference. - private isClassDeclarationReference(ref: Reference): - ref is Reference { + private isClassDeclarationReference(ref: Reference): ref is Reference { return this.reflector.isClass(ref.node); } @@ -568,7 +567,7 @@ export class NgModuleDecoratorHandler implements if (Array.isArray(entry)) { // Recurse into nested arrays. refList.push(...this.resolveTypeList(expr, entry, className, arrayName)); - } else if (isDeclarationReference(entry)) { + } else if (entry instanceof Reference) { if (!this.isClassDeclarationReference(entry)) { throw createValueHasWrongTypeError( entry.node, entry, @@ -593,9 +592,3 @@ function isNgModule(node: ClassDeclaration, compilation: ScopeData): boolean { return !compilation.directives.some(directive => directive.ref.node === node) && !compilation.pipes.some(pipe => pipe.ref.node === node); } - -function isDeclarationReference(ref: any): ref is Reference { - return ref instanceof Reference && - (ts.isClassDeclaration(ref.node) || ts.isFunctionDeclaration(ref.node) || - ts.isVariableDeclaration(ref.node)); -}