Error: Cannot read properties of undefined (reading 'includes')
TypeError: Cannot read properties of undefined (reading 'includes')
I think it might be from these lines of code:
{
name: 'projectType',
title: 'Type',
type: 'array',
of: [{type: 'string'}],
options: {
list: [
{title: 'Building', value: 'building'},
{title: 'Districts', value: 'districts'},
],
layout: 'radio',
},
description:
'These are the types of properties in a project. Building will have number of floors and units. Districts will have number of villas/townhouses.',
},
{
name: 'numFloors',
title: 'Number of Floors',
type: 'number',
hidden: ({parent}: {parent: {projectType: string[]}}) =>
!parent.projectType.includes('building'),
description: 'It indicates the number of floors in the building.',
},
{
name: 'numUnits',
title: 'Number of Units',
type: 'number',
hidden: ({parent}: {parent: {projectType: string[]}}) =>
!parent.projectType.includes('building'),
description: 'It indicates the number of units in the building.',
},
{
name: 'numOfHouses',
title: 'Number of Villas/Townhouses',
type: 'number',
hidden: ({parent}: {parent: {projectType: string[]}}) =>
!parent.projectType.includes('districts'),
description: 'It indicates the number of villas or townhouses in the district.',
},