Property 'json' does not exist on type 'Document'.
I'm querying Contentful with GraphQL and it returns me content?: Document | undefined.
In order to render the file I need to access content.json, using @contentful/rich-text-html-renderer, and it works. The issue is that Typescript keeps warning me that Property 'json' does not exist on type 'Document'. even though it surely does.
Is the typing wrong? Is something to do with the typings this library provides or something else?
I am running into this same issue and have to do manual transforming to match the generated Document model, like so:
// Need to map GraphQL response to match model, an 'item' is of Document type return fetchResponse?.data?.postCollection?.items.map((x) => { return { ...x, content: x.content.json }; });
This is not ideal, of course.