This warning appears when you have an array type where multiple members resolve to the same underlying JSON type (e.g., both string and text resolve to JSON type "string"). When Sanity stores array data, it uses the JSON type to serialize values. If multiple array members share the same JSON type, Sanity cannot distinguish between them at runtime. For example, if an array allows both string and text items, there's no way to know which type a given string value was originally intended to be when reading the data back.
defineField({
name: 'content',
type: 'array',
of: [
{type: 'string', name: 'heading'},
{type: 'text', name: 'paragraph'}, // Both resolve to JSON "string"
],
})Both string and text (as well as url and email) resolve to the JSON type "string". This means we have no way to tell them apart when the document is read.
You have two options:
defineField({
name: 'content',
type: 'array',
of: [
{type: 'string'},
],
})defineField({
name: 'content',
type: 'array',
of: [
{
type: 'object',
name: 'heading',
title: 'Heading',
fields: [{name: 'value', type: 'string'}],
},
{
type: 'object',
name: 'paragraph',
title: 'Paragraph',
fields: [{name: 'value', type: 'text'}],
},
],
})defineField({
name: 'content',
type: 'array',
of: [
{type: 'string', name: 'heading'},
{type: 'text', name: 'paragraph'}, // Both resolve to JSON "string"
],
})defineField({
name: 'content',
type: 'array',
of: [
{type: 'string'},
],
})defineField({
name: 'content',
type: 'array',
of: [
{
type: 'object',
name: 'heading',
title: 'Heading',
fields: [{name: 'value', type: 'string'}],
},
{
type: 'object',
name: 'paragraph',
title: 'Paragraph',
fields: [{name: 'value', type: 'text'}],
},
],
})