gatsby-source-contentful
Version:
Gatsby source plugin for building websites using the Contentful CMS as a data source
20 lines (16 loc) • 578 B
TypeScript
import { ReactNode } from "react"
import { Options } from "@contentful/rich-text-react-renderer"
interface ContentfulRichTextGatsbyReference {
/**
* Either ContentfulAsset for assets or ContentfulYourContentTypeName for content types
*/
__typename: string
contentful_id: string
}
interface RenderRichTextData<T extends ContentfulRichTextGatsbyReference> {
raw?: string | null
references?: T[] | null
}
export function renderRichText<
TReference extends ContentfulRichTextGatsbyReference
>(data: RenderRichTextData<TReference>, options?: Options): ReactNode