UNPKG

@prismicio/helpers

Version:
17 lines (16 loc) 902 B
import { RichTextField } from "@prismicio/types"; /** * The return type of `asText()`. */ type AsTextReturnType<Field extends RichTextField | null | undefined> = Field extends RichTextField ? string : null; /** * Serializes a rich text or title field to a plain text string * * @param richTextField - A rich text or title field from Prismic * @param separator - Separator used to join each element, defaults to a space * * @returns Plain text equivalent of the provided rich text or title field * @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/technologies/templating-rich-text-and-title-fields-javascript} */ export declare const asText: <Field extends [] | [import("@prismicio/types").RTNode, ...import("@prismicio/types").RTNode[]] | null | undefined>(richTextField: Field, separator?: string) => AsTextReturnType<Field>; export {};