Open Jdruwe opened 2 months ago
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.