@prismicio/client
Version:
The official JavaScript + TypeScript client library for Prismic
42 lines (41 loc) • 1.55 kB
TypeScript
import { CustomTypeModelField } from "./types.js";
//#region src/types/model/customType.d.ts
/**
* A Prismic custom type model.
*
* @typeParam ID - API ID of the custom type.
* @typeParam Definition - The custom type's tabs and their fields.
*/
interface CustomTypeModel<ID extends string = string, Definition extends CustomTypeModelDefinition = CustomTypeModelDefinition> {
/** The ID of the custom type model. */
id: ID;
/** The human readable name of the custom type model. */
label: string | null | undefined;
/**
* The format of the custom type model.
*
* Fallback to "custom" if undefined.
*/
format?: "page" | "custom";
/** Determines if more than one document for the custom type can be created. */
repeatable: boolean;
/** The custom type model definition. */
json: Definition;
/** Determines if new documents for the custom type can be created. */
status: boolean;
}
/**
* A Prismic custom type's tabs and their fields.
*
* @typeParam TabName - Names of custom type tabs.
*/
type CustomTypeModelDefinition<TabName extends string = string> = Record<TabName, CustomTypeModelTab>;
/**
* A custom type's tab. Each tab can contain any number of fields but is limited to one Slice Zone.
*
* @typeParam FieldName - API IDs of the fields.
*/
type CustomTypeModelTab<Fields extends Record<string, CustomTypeModelField> = Record<string, CustomTypeModelField>> = Fields;
//#endregion
export { CustomTypeModel, CustomTypeModelDefinition, CustomTypeModelTab };
//# sourceMappingURL=customType.d.ts.map