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

groq-builder: add Sanity Codegen / Typegen documentation #285

Open
2 tasks done
scottrippey opened this issue May 1, 2024 · 1 comment
Open
2 tasks done

groq-builder: add Sanity Codegen / Typegen documentation #285

scottrippey opened this issue May 1, 2024 · 1 comment
Labels
documentation Improvements or additions to documentation groq-builder Related to the newer `groq-builder` package

Comments

@scottrippey
Copy link
Member

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct

Feature Request

Sanity Codegen / Typegen has been released, and is now the official, recommended way to generate Sanity schema types for consumption by groq-builder.

Currently, the documentation still lists the `ts-simplify` + `@sanity-typed/types` approach.  

While this is viable, the Sanity Codegen generated types have several advantages:
- Performance
- Simplicity
- Future-proof
- Better Developer Experience (named types, etc)

We need to update the documentation to showcase how to use Sanity Codegen together with `groq-builder`.
@scottrippey scottrippey added documentation Improvements or additions to documentation groq-builder Related to the newer `groq-builder` package labels May 1, 2024
@danteissaias
Copy link

The way references are handled in deref() has to be updated to support [internalGroqTypeReferenceTo] being undefined. Sanity's typegen makes them all optional.

 asset?: {
      _ref: string;
      _type: "reference";
      _weak?: boolean;
      [internalGroqTypeReferenceTo]?: "sanity.imageAsset";
    };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation groq-builder Related to the newer `groq-builder` package
Projects
None yet
Development

No branches or pull requests

2 participants