From 5d7856b7c4185559faeb40913eb07d178c5ff679 Mon Sep 17 00:00:00 2001 From: Gerrit Birkeland Date: Sun, 14 Mar 2021 13:42:21 -0600 Subject: [PATCH] fix: Correct crash with reflection types Resolves #1538 --- src/lib/converter/plugins/ImplementsPlugin.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/lib/converter/plugins/ImplementsPlugin.ts b/src/lib/converter/plugins/ImplementsPlugin.ts index 7c00235a0..b26095f89 100644 --- a/src/lib/converter/plugins/ImplementsPlugin.ts +++ b/src/lib/converter/plugins/ImplementsPlugin.ts @@ -1,4 +1,3 @@ -import { ok } from "assert"; import * as ts from "typescript"; import { DeclarationReflection, @@ -233,10 +232,13 @@ export class ImplementsPlugin extends ConverterComponent { return; } - ok( - reflection.parent instanceof DeclarationReflection, - "Should be impossible, disallowed by converter." - ); + // Need this because we re-use reflections for type literals. + if ( + !reflection.parent || + !reflection.parent.kindOf(ReflectionKind.ClassOrInterface) + ) { + return; + } const symbol = context.project.getSymbolFromReflection( reflection.parent