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