把设计图引用建模成 assetId 与 path 二选一的联合类型

src/features/ui-editor/uiDesignResourceBridge.ts 的 UiDesignDocImageReference 改为判别联合:原先两个字段都可选,`{}` 或两个都给要等到 Rust 运行时才被判错
This commit is contained in:
2026-09-24 16:10:50 +08:00
parent c8852ac2af
commit 0f9e2f1737
@@ -3,11 +3,13 @@ import type {
GameCreationAppManifest,
} from '../../../../../packages/shared/src/contracts/gameCreationApp';
/** 一张设计图的输入引用:给已登记资源的 assetId,或给项目内相对路径。 */
export type UiDesignDocImageReference = {
assetId?: string;
path?: string;
};
/**
* 一张设计图的输入引用:给已登记资源的 assetId,或给项目内相对路径。
* 两者只能二选一,与 Rust 侧 `每张设计图必须且只能给 assetId 或 path` 的判据一致。
*/
export type UiDesignDocImageReference =
| { assetId: string; path?: never }
| { assetId?: never; path: string };
export type UiDesignDocCreated = {
asset: GameCreationAppAssetManifestEntry;