Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(jsii): unknown error in Assembler._validateHeritageClauses #2350

Merged
merged 2 commits into from
Dec 14, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/jsii/lib/assembler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,12 @@ export class Assembler implements Emitter {
for (const clause of clauses) {
for (const node of clause.types) {
const parentType = this._typeChecker.getTypeAtLocation(node);
if (parentType.symbol == null) {
// The parent type won't have a symbol if it's an "error type" inserted by the type checker when the original
// code contains a compilation error. In such cases, the TypeScript compiler will already have reported about
// the incoherent declarations, so we'll just not re-validate it there (we'd fail anyway).
continue;
}
// For some reason, we cannot trust parentType.isClassOrInterface()
const badDecl = parentType.symbol.declarations.find(
(decl) =>
Expand Down