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?
I believe this is the best work around for now:

https://github.com/nhi/sanity-block-content-to-react-types
That did it! Thank you! πŸ™‚

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?