Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating TS types not working when importing defineQuery from next-sanity #1654

Open
Jdruwe opened this issue Aug 20, 2024 · 0 comments
Open

Comments

@Jdruwe
Copy link

Jdruwe commented Aug 20, 2024

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

image

Correct return type VS:

image

Notice Promise of the actual result vs any when using defineQuery from next-sanity.

@Jdruwe 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant