Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

Finding type definitions for schema types in a Slack thread.

5 replies
Last updated: Feb 27, 2024
Where can I find type definitions of schema types? E.g. I want to pass the type for this image object.


{
  _type: ‘image’,
  asset: {
    _ref: ‘image-xyz-jpg’,
    _type: ‘reference’
  }
}
Feb 27, 2024, 2:59 PM
import type { SanityImageSource } from '@sanity/image-url/lib/types/types';
Feb 27, 2024, 3:02 PM
Great, thank you!
Feb 27, 2024, 3:04 PM
no probs
Feb 27, 2024, 3:10 PM
I am using the one from Vercel templates
import type { ImageAsset, Slug } from '@sanity/types'
See:
https://github.com/sanity-io/sanity-template-nextjs-clean/blob/main/src/lib/sanity.queries.ts
Feb 27, 2024, 4:03 PM
Thanks, that looks more appropriate, I guess.
Feb 27, 2024, 4:08 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?