groq-js with typed GROQ Results
@[:page_toc](## Page Contents)
npm install groq-js @sanity-typed/groq-js
Use parse
and evaluate
exactly as you would from groq-js
. Then, use the results with the typescript types!
Typically, this isn't used directly, but via @sanity-typed/client-mock
's methods that produce groq results. But it can be done directly:
The supported Typescript version is now 5.4.2 <= x <= 5.6.3. Older versions are no longer supported and newer versions will be added as we validate it.
You can also use your typed schema to keep parity with the types your typed client would receive.
npm install sanity groq-js @sanity-typed/types @sanity-typed/groq-js