Skip to content

Commit b9431e8

Browse files
alxhubvicb
authored andcommitted
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
1 parent 7790cfa commit b9431e8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/compiler/src/aot/static_reflector.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,9 @@ export class StaticReflector implements CompileReflector {
163163
let ownAnnotations: any[] = [];
164164
if (classMetadata['decorators']) {
165165
ownAnnotations = simplify(type, classMetadata['decorators']);
166-
annotations.push(...ownAnnotations);
166+
if (ownAnnotations) {
167+
annotations.push(...ownAnnotations);
168+
}
167169
}
168170
if (parentType && !this.summaryResolver.isLibraryFile(type.filePath) &&
169171
this.summaryResolver.isLibraryFile(parentType.filePath)) {

0 commit comments

Comments
 (0)