How AI is powering better personalization in e-commerce [with Vercel]. Sign up now →

Should I use defineArrayMember instead of defineField for array items in Sanity?

7 repliesLast updated: Nov 29, 2025

defineField({
      title: "Navigation",
      description: "Select pages or link for main navigation",
      name: "navigation",
      type: "array",
      group: "navigation",
      of: [
        defineField({
          title: "Internal Link",
          name: "internalLink",
          type: "internalLink"
        }),
        defineField({
          title: "External Link",
          name: "externalLink",
          type: "externalLink"
        })
      ]
    }),
Quick question, isn't this supposed to be defineArrayMember instead of defineField on the type errors?
AI Update

Yes, you're absolutely right! In the of array of an array field, you should use defineArrayMember instead of defineField.

The corrected version should be:

defineField({
  title: "Navigation",
  description: "Select pages or link for main navigation",
  name: "navigation",
  type: "array",
  group: "navigation",
  of: [
    defineArrayMember({
      title: "Internal Link",
      name: "internalLink",
      type: "internalLink"
    }),
    defineArrayMember({
      title: "External Link",
      name: "externalLink",
      type: "externalLink"
    })
  ]
})

The key distinction is:

Using defineArrayMember provides proper TypeScript typing support for array members. While your schema might work with defineField in some cases, defineArrayMember is the correct and recommended approach for array members and will give you better type safety and IDE support.

Show original thread
7 replies

Was this answer helpful?

Sanity – Build the way you think, not the way your CMS thinks

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.

Related contributions