@prismicio/client
Version:
The official JavaScript + TypeScript client library for Prismic
79 lines (78 loc) • 3.05 kB
TypeScript
import type { InjectMigrationSpecificTypes } from "../types/migration/Document";
import type { FilledContentRelationshipField } from "../types/value/contentRelationship";
import type { PrismicDocument } from "../types/value/document";
import type { GroupField } from "../types/value/group";
import type { ImageField } from "../types/value/image";
import type { OptionalLinkProperties } from "../types/value/link";
import type { FilledLinkToMediaField } from "../types/value/linkToMedia";
import { type RTImageNode } from "../types/value/richText";
import type { SliceZone } from "../types/value/sliceZone";
import type { AnyRegularField } from "../types/value/types";
/**
* Unknown value to check if it's a specific field type.
*
* @remarks
* Explicit types are added to help ensure narrowing is done effectively.
*/
type UnknownValue = PrismicDocument | InjectMigrationSpecificTypes<AnyRegularField | GroupField | SliceZone> | unknown;
/**
* Checks if a value is a link to media field.
*
* @param value - Value to check.
*
* @returns `true` if `value` is a link to media field, `false` otherwise.
*
* @internal
* This is not an official helper function and it's only designed to work with internal processes.
*/
export declare const filledLinkToMedia: (value: UnknownValue) => value is FilledLinkToMediaField;
/**
* Checks if a value is an image field.
*
* @param value - Value to check.
*
* @returns `true` if `value` is an image field, `false` otherwise.
*
* @internal
* This is not an official helper function and it's only designed to work with internal processes.
*/
export declare const filledImage: (value: UnknownValue) => value is ImageField<string, "filled">;
/**
* Checks if a value is a rich text image node.
*
* @param value - Value to check.
*
* @returns `true` if `value` is a rich text image node, `false` otherwise.
*
* @internal
* This is not an official helper function and it's only designed to work with internal processes.
*/
export declare const rtImageNode: (value: UnknownValue) => value is RTImageNode;
/**
* Checks if a value is a content relationship field.
*
* @remarks
* The return value includes `OptionalLinkProperties` because
* `FilledContentRelationshipField` may be a link field, not strictly a content
* relationship field.
*
* @param value - Value to check.
*
* @returns `true` if `value` is a content relationship, `false` otherwise.
*
* @internal
* This is not an official helper function and it's only designed to work with internal processes.
*/
export declare const filledContentRelationship: (value: UnknownValue) => value is FilledContentRelationshipField & OptionalLinkProperties;
/**
* Checks if a value is a Prismic document.
*
* @param value - Value to check.
*
* @returns `true` if `value` is a Prismic document, `false` otherwise.
*
* @internal
* This is not an official helper function and it's only designed to work with internal processes.
*/
export declare const prismicDocument: (value: UnknownValue) => value is PrismicDocument;
export {};