fix(ivy): ngcc generates setClassMetadata calls for ES5 bundles (#27438)

ngcc would feed ngtsc with the function declaration inside of an IIFE as
that is considered the class symbol's declaration node, according to
TypeScript's `ts.Symbol.valueDeclaration`. ngtsc however only considered
variable decls and actual class decls as potential class declarations,
so given the function declaration node it would fail to generate the
`setClassMetadata` call.

ngtsc no longer makes its own assumptions about what classes look like,
but always asks the reflection host to yield this kind of information.

PR Close #27438
This commit is contained in:
JoostK
2018-12-04 22:10:37 +01:00
committed by Miško Hevery
parent 84084b1bdb
commit 52544ffaa3
5 changed files with 8 additions and 13 deletions

View File

@ -38,7 +38,9 @@ export class Esm5ReflectionHost extends Esm2015ReflectionHost {
/**
* Check whether the given node actually represents a class.
*/
isClass(node: ts.Node): boolean { return super.isClass(node) || !!this.getClassSymbol(node); }
isClass(node: ts.Node): node is ts.NamedDeclaration {
return super.isClass(node) || !!this.getClassSymbol(node);
}
/**
* Find a symbol for a node that we think is a class.