You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Notice Promise of the actual result vs any when using defineQuery from next-sanity.
The text was updated successfully, but these errors were encountered:
Jdruwe
changed the title
Generating TS type not working when importing defineQuery from next-sanity
Generating TS types not working when importing defineQuery from next-sanity
Aug 20, 2024
Does it work again if you install @sanity/client explicitly? We've seen that with some package managers, like pnpm, peer dependencies are not hoisted by default. And our auto type gen which uses declare module "@sanity/client" doesn't work, since you don't have a ./node_modules/@sanity/client folder 🤔
I was reading the updated docs on generating types: https://github.com/sanity-io/next-sanity?tab=readme-ov-file#generate-typescript-types. I updated both next-sanity & sanity to the latest versions and tried generating the types. I noticed that when I import define query like this, it doesn't work
import { defineQuery } from 'next-sanity';
When I import it directly from groq it does work:
import { defineQuery } from 'groq';
Expected behavior
Correct return type VS:
Notice Promise of the actual result vs any when using defineQuery from next-sanity.
The text was updated successfully, but these errors were encountered: