diff --git a/lib/types/index.ts b/lib/types/index.ts index 1fc0d6e690..0d308cbf62 100644 --- a/lib/types/index.ts +++ b/lib/types/index.ts @@ -70,6 +70,7 @@ export type { Items, Link, WithOptionalId, + WithId, } from './utils' export type { WindowAPI } from './window.types' diff --git a/lib/types/space.types.ts b/lib/types/space.types.ts index 1590e86cb4..272a1b1f6c 100644 --- a/lib/types/space.types.ts +++ b/lib/types/space.types.ts @@ -1,4 +1,3 @@ -/* Space API */ import { Entry } from './entry.types' import { Asset, diff --git a/lib/types/utils.ts b/lib/types/utils.ts index 1a04b34444..9c31f8dbe2 100644 --- a/lib/types/utils.ts +++ b/lib/types/utils.ts @@ -1,14 +1,19 @@ -type SysWithId = { +type Sys = { id: string + type: string + [key: string]: any } -export type WithOptionalId = Omit & { - sys?: Partial & SysWithId> +type Entity = { + sys: Sys + [key: string]: any } -export type WithId = Omit & { - sys: Partial> & SysWithId -} +type Optional = Partial & Omit + +export type WithSysWithAtLeastId = { sys: { id: string; [key: string]: any } } +export type WithId = Omit & WithSysWithAtLeastId +export type WithOptionalId = Optional | WithId export interface Link { sys: {