Customize TypeGen in your CLI configuration
Published: November 25, 2025
v4.19.0
Sanity Studio
This release introduces a change to the way you define Sanity TypeGen configurations, as well as bug fixes for asset selection with required field validation, schema validation in the CLI, and performance improvements for comments in the Portable Text Editor.
✨ Highlights
TypeGen configurations move to sanity.cli.ts
TypeGen configurations are now managed through the sanity.cli.ts configuration file. You can move your configurations over from sanity-typegen.json to the typegen key in the CLI config as shown below:
Before (now deprecated)
{
"path": "'../../my-cool-app/src/**/*.{ts,tsx,js,jsx}'",
"schema": "../../my-cool-app/sanity-schemas.json",
"generates": "../../my-cool-app/sanity.types.ts"
}After
import { defineCliConfig } from 'sanity/cli';
export default defineCliConfig({
// ...rest of config
typegen: {
path: "'../../my-cool-app/src/**/*.{ts,tsx,js,jsx}'",
schema: "../../my-cool-app/sanity-schemas.json",
generates: "../../my-cool-app/sanity.types.ts"
},
})🐛 Notable bugfixes
- Fixed an issue where
sanity schema validatewould fail because it couldn't find thesanity.videotype. This command now correctly loads the configuration and includes default plugins. - Fixed an error where the
assetRequired()validation rule prevented you from selecting assets in Media Library, creating a catch-22 where you couldn't pick an asset because the field required one. - Fixed an issue in Content Releases where the time input wasn't updating correctly when using a timezone different from your local one.
- Fixed a bug causing excessive mutations in the comments dataset when working in Portable Text Editor. In extreme cases, these mutations could result in rate limiting. The editor now only submits mutations for comments that have changed.
- Improved document status copy for published documents, making it clear that timestamps reflect the last edit or publish time.