fix(compiler): handle undefined annotation metadata (#23349)

In certain cases seen in production, simplify() can returned
undefined when simplifying decorator metadata. This has proven tricky
to reproduce in an isolated test, but the fix is simple and low-risk:
don't attempt to spread an undefined set of annotations in the first
place.

PR Close #23349
This commit is contained in:
Alex Rickabaugh 2018-04-12 14:57:56 -07:00 committed by Victor Berchet
parent f2563ca800
commit ca776c59dd
1 changed files with 3 additions and 1 deletions

View File

@ -163,7 +163,9 @@ export class StaticReflector implements CompileReflector {
let ownAnnotations: any[] = [];
if (classMetadata['decorators']) {
ownAnnotations = simplify(type, classMetadata['decorators']);
annotations.push(...ownAnnotations);
if (ownAnnotations) {
annotations.push(...ownAnnotations);
}
}
if (parentType && !this.summaryResolver.isLibraryFile(type.filePath) &&
this.summaryResolver.isLibraryFile(parentType.filePath)) {