From bfc26bcd8c700a4ab89ad1cef69343a302c0527a Mon Sep 17 00:00:00 2001 From: Alex Rickabaugh Date: Thu, 15 Aug 2019 13:10:18 -0700 Subject: [PATCH] fix(ivy): run template type-checking for all components (#31952) PR Close #31952 --- .../src/ngtsc/annotations/src/component.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/compiler-cli/src/ngtsc/annotations/src/component.ts b/packages/compiler-cli/src/ngtsc/annotations/src/component.ts index dc7a0014bb..5f18e37ffd 100644 --- a/packages/compiler-cli/src/ngtsc/annotations/src/component.ts +++ b/packages/compiler-cli/src/ngtsc/annotations/src/component.ts @@ -353,15 +353,16 @@ export class ComponentDecoratorHandler implements if (!ts.isClassDeclaration(node)) { return; } - const scope = this.scopeReader.getScopeForComponent(node); + + const pipes = new Map>>(); const matcher = new SelectorMatcher(); + + const scope = this.scopeReader.getScopeForComponent(node); if (scope !== null) { for (const meta of scope.compilation.directives) { const extMeta = flattenInheritedDirectiveMetadata(this.metaReader, meta.ref); matcher.addSelectables(CssSelector.parse(meta.selector), extMeta); } - const bound = new R3TargetBinder(matcher).bind({template: meta.parsedTemplate.nodes}); - const pipes = new Map>>(); for (const {name, ref} of scope.compilation.pipes) { if (!ts.isClassDeclaration(ref.node)) { throw new Error( @@ -369,8 +370,10 @@ export class ComponentDecoratorHandler implements } pipes.set(name, ref as Reference>); } - ctx.addTemplate(new Reference(node), bound, pipes, meta.parsedTemplate.file); } + + const bound = new R3TargetBinder(matcher).bind({template: meta.parsedTemplate.nodes}); + ctx.addTemplate(new Reference(node), bound, pipes, meta.parsedTemplate.file); } resolve(node: ClassDeclaration, analysis: ComponentHandlerData): ResolveResult {