Skip to content

Commit 91cfa1b

Browse files
zslaytonGerrit0
andauthored
fix: Mixin symbols might not have declarations (#1208)
* fix: Avoid iterating over undefined array. * chore: Fix lint + add note about TS weirdness Co-authored-by: Gerrit Birkeland <gerrit@gerritbirkeland.com>
1 parent c75df1c commit 91cfa1b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/lib/converter/nodes/class.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,12 @@ export class ClassConverter extends ConverterNodeComponent<ts.ClassDeclaration>
6969
const typesToInheritFrom: ts.Type[] = type.isIntersection() ? type.types : [ type ];
7070

7171
typesToInheritFrom.forEach((typeToInheritFrom: ts.Type) => {
72-
typeToInheritFrom.symbol && typeToInheritFrom.symbol.declarations.forEach((declaration) => {
72+
// TODO: The TS declaration file claims that:
73+
// 1. type.symbol is non-nullable
74+
// 2. symbol.declarations is non-nullable
75+
// These are both incorrect, GH#1207 for #2 and existing tests for #1.
76+
// Figure out why this is the case and document.
77+
typeToInheritFrom.symbol?.declarations?.forEach((declaration) => {
7378
context.inherit(declaration, baseType.typeArguments);
7479
});
7580
});

0 commit comments

Comments
 (0)