diff --git a/src/widgets/widgetMap.ts b/src/widgets/widgetMap.ts index 4f5b5b3f2..07dc9033a 100644 --- a/src/widgets/widgetMap.ts +++ b/src/widgets/widgetMap.ts @@ -59,6 +59,8 @@ export function toConcreteWidget( node: LGraphNode, wrapLegacyWidgets = true, ): WidgetTypeMap[TWidget["type"]] | undefined { + if (widget instanceof BaseWidget) return widget + // Assertion: TypeScript has no concept of "all strings except X" type RemoveBaseWidgetType = T extends { type: TWidgetType } ? T : never const narrowedWidget = widget as RemoveBaseWidgetType