Skip to content
Permalink
Browse files

fix(ivy): run template type-checking for all components (#31952)

PR Close #31952
  • Loading branch information...
alxhub authored and AndrewKushnir committed Aug 15, 2019
1 parent daac386 commit bfc26bcd8c700a4ab89ad1cef69343a302c0527a
Showing with 7 additions and 4 deletions.
  1. +7 −4 packages/compiler-cli/src/ngtsc/annotations/src/component.ts
@@ -353,24 +353,27 @@ export class ComponentDecoratorHandler implements
if (!ts.isClassDeclaration(node)) {
return;
}
const scope = this.scopeReader.getScopeForComponent(node);

const pipes = new Map<string, Reference<ClassDeclaration<ts.ClassDeclaration>>>();
const matcher = new SelectorMatcher<DirectiveMeta>();

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<string, Reference<ClassDeclaration<ts.ClassDeclaration>>>();
for (const {name, ref} of scope.compilation.pipes) {
if (!ts.isClassDeclaration(ref.node)) {
throw new Error(
`Unexpected non-class declaration ${ts.SyntaxKind[ref.node.kind]} for pipe ${ref.debugName}`);
}
pipes.set(name, ref as Reference<ClassDeclaration<ts.ClassDeclaration>>);
}
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 {

0 comments on commit bfc26bc

Please sign in to comment.
You can’t perform that action at this time.