
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeYes, 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 typesdefineArrayMember is specifically for defining the types of items that can be contained within an array field's of propertyUsing 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.
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