UNPKG

@prismicio/types-internal

Version:
26 lines (24 loc) 492 B
export type Asset = { id: string last_modified: string kind: "image" | "all" filename?: string extension?: string size?: number origin_url: string url: string width?: number height?: number notes?: string credits?: string alt?: string } export const getAssetOrThrow = (assets: Record<Asset["id"], Asset | undefined>) => (assetId: Asset["id"]) => { const asset = assets[assetId] if (!asset) { throw new Error(`Missing asset with id '${assetId}'!`) } return asset }