惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
DataBreaches.Net
V
Vulnerabilities – Threatpost
C
CERT Recently Published Vulnerability Notes
Google DeepMind News
Google DeepMind News
GbyAI
GbyAI
Y
Y Combinator Blog
T
Threatpost
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Project Zero
Project Zero
Engineering at Meta
Engineering at Meta
MongoDB | Blog
MongoDB | Blog
MyScale Blog
MyScale Blog
Security Latest
Security Latest
T
Threat Research - Cisco Blogs
量子位
I
Intezer
Simon Willison's Weblog
Simon Willison's Weblog
C
Cybersecurity and Infrastructure Security Agency CISA
L
Lohrmann on Cybersecurity
L
LINUX DO - 最新话题
The Register - Security
The Register - Security
T
Tailwind CSS Blog
爱范儿
爱范儿
Google DeepMind News
Google DeepMind News
T
Troy Hunt's Blog
Stack Overflow Blog
Stack Overflow Blog
Cloudbric
Cloudbric
S
Secure Thoughts
The GitHub Blog
The GitHub Blog
T
The Blog of Author Tim Ferriss
L
LangChain Blog
Recorded Future
Recorded Future
小众软件
小众软件
www.infosecurity-magazine.com
www.infosecurity-magazine.com
T
Tor Project blog
人人都是产品经理
人人都是产品经理
F
Full Disclosure
O
OpenAI News
Webroot Blog
Webroot Blog
A
Arctic Wolf
TaoSecurity Blog
TaoSecurity Blog
P
Privacy & Cybersecurity Law Blog
Jina AI
Jina AI
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
雷峰网
雷峰网
Microsoft Security Blog
Microsoft Security Blog
H
Heimdal Security Blog
B
Blog RSS Feed
Vercel News
Vercel News

Sanity.io

A Board Game agent built using Sanity Context and Vercel's AI SDK | Sanity Build a prototype with Claude Code that your whole team can edit | Sanity What’s New - May 2026 | Sanity I built a London pub guide with v0 and the Sanity MCP in six hours. Here's what I learned. | Sanity Build a conference concierge with Agent Context and Anthropic | Sanity Build a content-aware Telegram agent with Vercel AI SDK and Chat SDK | Sanity How I used Agent API to generate photos for my family’s recipes | Sanity What’s New April - 2026 | Sanity Better context, better matches: An AI love story (for dogs) | Sanity How to write for an agent | Sanity Content Agent, meet Slack: AI content operations in your workflow | Sanity Structure powers intelligence | Sanity Your agent needs better content. Here's how to give it. | Sanity How to serve content to agents (a field guide) | Sanity Sanity is now available on the Vercel Marketplace | Sanity The logo soup problem (and how to solve it) | Sanity Content Releases: From scattered updates to coordinated publishing | Sanity What's New - February 2026 | Sanity How we solved the agent memory problem | Sanity v0 Builder Challenge: The winners | Sanity Introducing: Sanity Agent Skills | Sanity Content Agent: Days of work in one conversation | Sanity Our Sanity Values | Sanity Open Source Pledge 2025: Stepping up when it matters | Sanity v0 builder challenge: $3000 in prizes | Sanity Why AI Breaks Without Structured Content Operations | Sanity What’s New January - 2026 | Sanity BFCM 2025: What teams built when infrastructure stopped being the problem | Sanity How AI shaped holiday shopping and what it means for content in 2026 | Sanity Sanity Studio v5: Embracing React 19 | Sanity You’ll need a CMS eventually. Let your agent set it up. | Sanity “You should never build a CMS” | Sanity AI Content Operations: A 30-Day Implementation Guide | Sanity What’s New December - 2025 | Sanity Scheduled Drafts: Stop manually publishing content at midnight | Sanity What’s New November - 2025 | Sanity Everything *[NYC] 2025 recap: A day of AI, Content Operations, and Culture | Sanity Clankers and content operations | Sanity Content Agent: AI that understands your structured content is here | Sanity Why design-driven content modeling creates technical debt, not velocity | Sanity What's New October - 2025 | Sanity From studio to inbox: How Kevin Green eliminated email campaign friction | Sanity The content editor's guide to content operations [E-commerce edition] | Sanity styled-components maintenance mode: A 40% faster fork | Sanity From zero code to a live website in 7 hours (thanks, Cursor!) | Sanity First attempt will be 95% garbage: A staff engineer's 6-week journey with Claude Code | Sanity Internationalization is more than translating words | Sanity What's New - September 2025 | Sanity We just deleted our 35k-member community Slack | Sanity What's New - August 2025 | Sanity The engineer's guide to content operations [E-commerce edition] | Sanity SEO for AI: Evolving from Web Pages to the Content Lake | Sanity What's New - July 2025 | Sanity Sanity Studio v4: A major version bump for a minor reason | Sanity What's New - June 2025 | Sanity Dashboard and Insights: Your New Content HQ | Sanity Canvas: AI-accelerated, context-aware, freeform authoring | Sanity Agent Actions: AI building blocks for structured content | Sanity Functions: Life beyond pressing publish | Sanity A new era for content applications with Sanity App SDK | Sanity The end of CMS era and our $85M Series C. | Sanity What's New – May 2025 | Sanity Introducing the Sanity Model Context Protocol (MCP) server | Sanity What's New – April 2025 | Sanity Pushing all the envelopes with ambitious content | Sanity Self-hosting is only free if your time is worth nothing | Sanity Content that lasts: Scaling beyond your frontend | Sanity The Live Content API is now Generally Available | Sanity The future beyond AI chat bots | Sanity Learning the new skill of working with AI | Sanity What's New - March 2025 | Sanity Give it in plain text: Making your content AI-Ready | Sanity No More 'DO NOT PUBLISH': Introducing Content Releases | Sanity React in 2025, what's next? | Sanity The final boss of front-end: block editors | Sanity Introducing Sanity for Startups | Sanity A block content editor that loves you back | Sanity A Black Friday Snooze Fest: Massive Traffic, No Drama | Sanity How to make a recipe site that scales well | Sanity The Sanity Winter Release 2024 | Sanity AVIF Arrives, Sanity’s Promise Fulfilled | Sanity Sanity joins the Open Source Pledge | Sanity Your content is now Live by default | Sanity Begin Team to Join Sanity | Sanity Sanity Digest - September '24 Edition | Sanity Sanity partners with Google. Now live on the Google Cloud Marketplace. | Sanity Sanity Digest - August ‘24 Edition | Sanity Now playing: the latest Mux Video Input plugin for Sanity | Sanity Community Digest - June ‘24 Edition | Sanity Community Digest - May ‘24 Edition | Sanity Guide to Sanity's newest product announcements | Sanity AI and Content Creation: A Leader's Guide | Sanity Of course, you should be able to type your content quickly! | Sanity New to AI Assist: translation, reference suggestions, image generation | Sanity Speak the language of your editors: Sanity Studio UI localization | Sanity Introducing the new Sanity Growth plan to serve collaborative teams | Sanity Presentation: Work faster than ever with structured content | Sanity Goodbye Feedback Frenzy, Hello Sanity Studio Comments! | Sanity Easing into the App Router with the Sanity Toolkit for Next.js | Sanity Making website updates easier with structured content | Sanity
Sanity TypeGen GA: Automatic TypeScript types for content and GROQ | Sanity
Knut Melvær · 2026-02-17 · via Sanity.io

AI coding tools are only as good as the context you give them. Point Claude, Cursor, or Copilot at vague, or no, types and you get vague suggestions. Give them precise types and they autocomplete correctly, catch edge cases, and stop hallucinating field names.

Sanity TypeGen generates precise TypeScript types from your content schemas and GROQ queries. Which means that you (and your agents) get the most out of the flexbility of GROQ, without losing the power of a well-defined schema. Few, if any, CMSes out there give you this developer experience.

So instead of event.format: string, you get 'in-person' | 'virtual'. Instead of post.coverImage: any, you get the full image structure with asset reference and optional alt text. Your editor autocompletes GROQ projections. Your AI assistant stops inventing fields (🤞). Your types stay in sync with your content model.

TypeGen is now generally available in Sanity Studio v5 with automatic regeneration, consolidated configuration, and stable APIs. If you used the beta, the migration is straightforward, the breaking changes are intentional improvements that make generated types more accurate.

Types that stay in sync while coding

The most requested feature during the beta was automation. Manually running sanity schema extract and sanity typegen generate every time you changed a schema or query worked, but it was easy to forget and end up with stale types.

Now you can turn on automatic type generation with a single config option. When you enable typegen.enabled: true, TypeGen will run automatically during sanity dev:

Running sanity dev now watches your schema and query files automatically. If you're running a separate frontend repo, use the --watch flag:

One config file, not two

TypeGen originally had sanity-typegen.json for configuration. Now everything lives in sanity.cli.ts alongside your other CLI settings.

The old config file still works but now shows a deprecation warning.

One caveat: if you’re in a mono repo where the studio and other apps are in different packages, you'll still need the JSON schema for those:

  • Enable schemaExtraction.enabled: true in the studio's sanity.cli.ts to produce the schema.json.
  • Then point your frontend/apps repo's typegen config at that generated schema file.

Faster generation (with a progress bar, finally)

We rewrote the type generation internals with memoization, so updates in watch mode are significantly faster. You'll also see a progress indicator during generation so you know it's working. (No, we can’t promise we have finaly solved the halting problem.)

Smarter generated output

The generated types are now more accurate and easier to work with:

  • Preserved casing: A query named MyPageQuery now produces MyPageQueryResult instead of MypagequeryResult
  • Correct non-identifier keys: Fields with kebab-case or special characters are now properly quoted
  • Smaller output: Array types now use an ArrayOf utility type, reducing duplication and file size

Type utilities for real-world schemas

Two new utility types make it easier to work with complex content models. This is especially handy for landing page-type content that tends to get nested.

The Get utility extracts deeply nested properties (up to 20 levels):

The FilterByType utility pulls specific types from unions using the _type discriminator:

Framework support beyond Next.js

The TypeGen tooling now supports @sanity/sveltekit defineQuery imports and can parse .svelte and .vue files. Support for .astro files was already available.

What “GA” means (and what it doesn't)

General availability means the TypeGen APIs are stable. The configuration format, CLI commands, and utility types won't change in breaking ways. Generated output will continue to improve, but those improvements will remain compatible with your existing code.

Some limitations remain:

Getting started

Setup depends on your project structure. Here are the three most common scenarios:

If you're running sanity dev or sanity build in your studio

In your studio, you typically want schema extraction enabled to generate the schema.json file. If you only need the schema.json (for example, to use in other packages), enable schemaExtraction.enabled: true. If you also need types in your studio code (for custom components, etc.), add typegen.enabled: true as well. Both control whether these processes run as part of sanity dev and sanity build commands.

Monorepo with separate studio and frontend packages

In your studio's sanity.cli.ts, enable schemaExtraction.enabled: true to generate the schema.json file when you run sanity dev or sanity build. Add typegen.enabled: true if you also want to generate types for use in the studio itself.

In your frontend packages, run sanity typegen generate --watch and configure the path to point to the schema.json generated by the studio. Since frontend repos don't use sanity dev or sanity build, you run the typegen command directly with the --watch flag for automatic regeneration during development.

Studio embedded in another app

If your Studio is embedded on an app route (Next.js, Astro, Nuxt, etc.), you're not using sanity dev or sanity build to build your app. This means the enabled flags won't help you. Instead, you'll need to run the CLI commands directly:

  • sanity schema extract to generate the schema JSON
  • sanity typegen generate to create types (use --watch for automatic regeneration during development)

Migrating from the beta

If you're using the beta, here's the migration path:

  1. Update to Sanity Studio v5
  2. Move config from sanity-typegen.json to sanity.cli.ts
  3. Regenerate types (expect diffs due to improvements)
  4. Enable automatic generation with enabled: true

The breaking changes are intentional corrections that make the generated types more accurate.

Everything that changed since beta

Here’s the smørgåsbord of most of the things we improved:

  • Automatic type generation during sanity dev and sanity build
  • Configuration moved to sanity.cli.ts
  • Progress indicator during generation
  • Memoization for faster watch mode updates
  • Preserved casing in generated type names
  • Proper quoting for non-identifier keys
  • ArrayOf utility type for smaller output
  • Get utility for extracting nested types (up to 20 levels)
  • FilterByType utility for filtering union types
  • Support for @sanity/sveltekit defineQuery
  • Parsing support for .svelte and .vue files
  • @sanity-typegen-ignore comment support
  • Stable API surface (no more breaking changes planned)

The Sanity Learn course has been updated to reflect all these changes. If you're new to TypeGen or want to see the latest features in action, it's a great place to start.

Thanks to Kristoffer Brabrand, Rico Kahler, and Sindre Gulseth for the work here. And to everyone who tested the beta and provided feedback. If you run into issues or have suggestions, join us in the #typescript channel in the Sanity community Discord.