
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeYes, there are built-in TypeScript types for the Structure Builder! The S parameter in your desk structure function is typed.
To get proper TypeScript intellisense, you should import and use the StructureResolver type from sanity/structure. Here's how to add types to your code:
import type {StructureResolver} from 'sanity/structure'
export const structure: StructureResolver = (S) =>
S.list()
.title('Content')
.items([
...S.documentTypeListItems().filter(
(listItem) => !['archive'].includes(listItem.getId()),
),
])By typing your structure export as StructureResolver, TypeScript will automatically infer the correct type for the S parameter, giving you full intellisense for all the Structure Builder methods like .list(), .listItem(), .document(), etc.
The Structure Builder API reference documentation has more details on all available methods and their types. The StructureResolver type is the key to unlocking intellisense for your custom desk structures in Sanity Studio v3+.
If you're using JavaScript instead of TypeScript, you can still get some intellisense by adding a JSDoc comment:
/** @type {import('sanity/structure').StructureResolver} */
export const structure = (S) =>
S.list()
.title('Content')
.items([
// your structure here
])Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store