😎 Discover cool tips and tricks for customization in our next Developer Deep Dive virtual event - sign up now!

Adding Sanity to a Typescript Project creates issues with Block Content

2 replies
Last updated: Feb 10, 2021
Hi! I'm adding Sanity to a TS-project. Having problem with the Block-content. I've done npm i @sanity/types and added "typeRoots": ["node_modules/@sanity/types/parts", "node_modules/@types"] to my compilerOptions, but still not working... Any thoughts?
Feb 10, 2021, 11:19 AM
I believe this is the best work around for now:

https://github.com/nhi/sanity-block-content-to-react-types
Feb 10, 2021, 11:59 AM
That did it! Thank you! πŸ™‚
Feb 10, 2021, 12:14 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?