Sanity TypeGen
Sanity TypeGen
To generate the types, run the following command:
pnpm typegen
This will generate schema.json
file in the /studio
folder and sanity.types.ts
file in the /frontend
folder.
You need to run this command every time you make changes to the schema and queries. Or when you create a new document type. Otherwise, you will get type errors for frontend.