Skip to content

Commit

Permalink
fix: Mixin symbols might not have declarations (#1208)
Browse files Browse the repository at this point in the history
* fix: Avoid iterating over undefined array.
* chore: Fix lint + add note about TS weirdness

Co-authored-by: Gerrit Birkeland <gerrit@gerritbirkeland.com>
  • Loading branch information
zslayton and Gerrit0 authored Feb 15, 2020
1 parent c75df1c commit 91cfa1b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/lib/converter/nodes/class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@ export class ClassConverter extends ConverterNodeComponent<ts.ClassDeclaration>
const typesToInheritFrom: ts.Type[] = type.isIntersection() ? type.types : [ type ];

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

0 comments on commit 91cfa1b

Please sign in to comment.