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