diff --git a/packages/api/src/localizedTree.ts b/packages/api/src/localizedTree.ts index 50f950d..3c1b9bf 100644 --- a/packages/api/src/localizedTree.ts +++ b/packages/api/src/localizedTree.ts @@ -39,6 +39,15 @@ export class TypeInfoLocalizer { constructor(private retrieveTypeInfo?: TypeInfoRetriever) {} + hasTypeInfo(info: TypeInfo): boolean { + return this.typeInfoMaps.has(info) + } + + hasLocalizedTypeInfo(localizedInfo: LocalizedTypeInfo): boolean { + const info = this.localizedInfoOrigin.get(localizedInfo) + return !!(info && this.hasTypeInfo(info)) + } + private localizeTypeInfo( resolvedInfo: ResolvedArrayTypeInfo, info?: TypeInfo, diff --git a/packages/typescript-explorer-vscode/src/view/typeTreeView.ts b/packages/typescript-explorer-vscode/src/view/typeTreeView.ts index 67430ba..7c4a668 100644 --- a/packages/typescript-explorer-vscode/src/view/typeTreeView.ts +++ b/packages/typescript-explorer-vscode/src/view/typeTreeView.ts @@ -102,7 +102,11 @@ export class TypeTreeProvider implements vscode.TreeDataProvider { this.createTypeNode(localizedTypeInfo, /* root */ undefined), ] } else { - assert(this.typeInfoLocalizer, "typeInfoLocalizer should exist") + if ( + !this.typeInfoLocalizer?.hasLocalizedTypeInfo(element.typeInfo) + ) { + return [] + } const localizedChildren = await this.typeInfoLocalizer.localizeChildren(element.typeInfo)