Skip to content

Where to get type referenced from? #246

Answered by scottrippey
ringods asked this question in Q&A
Discussion options

You must be logged in to vote

@ringods Thank you for trying it out! While this is in alpha stage, we're getting close to a beta, and having you try this out is really useful and helpful. I'd love to help with this issue.

When the Sanity config contains any "reference" types, the generated types will include a special unique symbol called referenced. For example, here's an abbreviated Variant document definition:

import { defineArrayMember, defineField, defineType } from "@sanity-typed/types";

export const Variant = defineType({
  name: "variant",
  type: "document",
  fields: [
    defineField({ name: "name", type: "string", }),
    defineField({ name: "price", type: "number", }),
    defineField({
      name: "flavo…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@scottrippey
Comment options

@ringods
Comment options

@scottrippey
Comment options

@ringods
Comment options

@saiichihashimoto
Comment options

Answer selected by ringods
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants