refactor(sdk): use WidgetNode union in goView converter

This commit is contained in:
clawdbot 2026-01-28 21:01:40 +08:00
parent 01b55b260d
commit 5f67a5bca1

View File

@ -1,11 +1,8 @@
import {
ASTRALVIEW_SCHEMA_VERSION,
createEmptyScreen,
type ImageWidgetNode,
type IframeWidgetNode,
type Screen,
type TextWidgetNode,
type VideoWidgetNode,
type WidgetNode,
} from '../schema';
import { convertGoViewImageOptionToNodeProps, type GoViewImageOption } from '../widgets/image';
import { convertGoViewIframeOptionToNodeProps, type GoViewIframeOption } from '../widgets/iframe';
@ -654,7 +651,7 @@ export function convertGoViewProjectToScreen(input: GoViewProjectLike | GoViewSt
[];
const componentList = Array.isArray(componentListRaw) ? componentListRaw : [];
const nodes: Array<TextWidgetNode | ImageWidgetNode | IframeWidgetNode | VideoWidgetNode> = [];
const nodes: WidgetNode[] = [];
for (const raw of componentList) {
if (!raw || typeof raw !== 'object') continue;