Sanity
Learn
CoursesTyped content with Sanity TypeGen
Track
Sanity Developer Certification

Typed content with Sanity TypeGen

6
Lessons

1: Introduction

1
Task

Learn how to use Sanity TypeGen to automatically generate TypeScript type definitions for documents in Sanity Content Lake and for the result of GROQ queries in your front ends and web applications.

2: Extracting your schema

1
Task

Learn how to extract your Sanity Studio schema into a JSON file. This is a crucial step before generating TypeScript types. This file, a static representation of your data's shape, will be used for type generation.

3: Generating types from your schema

1
Task

Learn how to generate TypeScript types from your Sanity Studio schema using the Sanity CLI. This process will create a 'sanity.types.ts' file, providing you with types for all your schema, including built-in and plugin-related types.

4: Configuring Sanity TypeGen for multiple-folder projects

3
Tasks

Configure Sanity TypeGen to place its generated files in the right locations. Run the typegen command and interpret its results.

5: Generating types for GROQ query results

4
Tasks

Make your queries discoverable. Generate TypeScript types for your GROQ queries.