UNPKG

@prismicio/client

Version:

The official JavaScript + TypeScript client library for Prismic

53 lines (51 loc) 1.77 kB
import { FieldState, Simplify } from "./types.js"; //#region src/types/value/image.d.ts /** * An individual image within an image field. The base image and each thumbnail * uses this type. * * @typeParam State - State of the field which determines its shape. * * @see {@link ImageField} for a full image field type. */ type ImageFieldImage<State extends FieldState = FieldState> = State extends "empty" ? EmptyImageFieldImage : FilledImageFieldImage; interface FilledImageFieldImage { id: string; url: string; dimensions: { width: number; height: number; }; edit: { x: number; y: number; zoom: number; background: string; }; alt: string | null; copyright: string | null; } interface EmptyImageFieldImage { id?: null; url?: null; dimensions?: null; edit?: null; alt?: null; copyright?: null; } /** * An image field. * * **Note**: Passing `null` to the `ThumbnailNames` parameter is deprecated and * will be removed in a future version. Use `never` instead. * * @typeParam ThumbnailNames - Names of thumbnails. If the field does not * contain thumbnails, `never` can be used to "disable" thumbnail fields. * @typeParam State - State of the field which determines its shape. * * @see Image field documentation: {@link https://prismic.io/docs/image} */ type ImageField<ThumbnailNames extends string | null = never, State extends FieldState = FieldState> = Simplify<State extends "filled" ? ImageFieldImage<State> & Record<Extract<ThumbnailNames, string>, ImageFieldImage<State>> : ImageFieldImage<State> & Record<Extract<ThumbnailNames, string>, ImageFieldImage<State>>>; //#endregion export { EmptyImageFieldImage, FilledImageFieldImage, ImageField, ImageFieldImage }; //# sourceMappingURL=image.d.ts.map