i have typescript error :
Type 'RichTextField' is not assignable to type 'string | null | undefined'.
Hello @loudmu
Thanks for reaching out to us.
Can you provide minimal reproduction and more information? Like:
- What version of prismic clients are you using?
- What function are you using for templating using
asText()
orasHTML()
? - Can you try the latest version using the following command?
npm update prismic-ts-codegen
I am looking forward to hearing from you back.
Thanks,
Priyanka
This issue has not been addressed in the latest slicemachine-ui update.. it's annoying because I have to delete the meta_description rich-text field and replace it with key text field every time I want to create a new page-type.
meta fields should always be key-text as the go in head element
Hello @loudmu
I agree with you. Meta Description should be Key Text, not Rich Text, to simplify passing the value to <meta>
tags. I will pass this feedback on to my team.
As it currently is configured, meta_description
would require the asText()
helper to convert to plain text. As an immediate solution, you can use meta_description
like this:
import { asText } from "@prismicio/client";
// To use meta_description as plain text:
<meta name="description" content={asText(page.data.meta_description)} />
Thanks,
Priyanka