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

7 replies
Last updated: Jan 28, 2026
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:

  • defineField is for defining regular schema fields at the top level or within object types
  • defineArrayMember is specifically for defining the types of items that can be contained within an array field's of property

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

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.

Was this answer helpful?