From 39da169babebb1d2ca5bcb34d712517a1685fd9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Gr=C3=B8ngaard?= Date: Thu, 30 May 2024 12:43:38 +0200 Subject: [PATCH] fix(types): correct `ArrayOptions` (#6737) - Removed the comment about `layout` since it's confusing/wrong. The `grid` option also works for a string array. - Added `list` as a valid `layout` option. Even though it's the default, it feels weird that you can't specify it manually. - Deprecated `direction` since it doesn't do anything anymore. --- packages/@sanity/types/src/schema/definition/type/array.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/@sanity/types/src/schema/definition/type/array.ts b/packages/@sanity/types/src/schema/definition/type/array.ts index 5a789f742e5..cafc16e8a92 100644 --- a/packages/@sanity/types/src/schema/definition/type/array.ts +++ b/packages/@sanity/types/src/schema/definition/type/array.ts @@ -11,13 +11,10 @@ import {type BaseSchemaDefinition, type SearchConfiguration, type TitledListValu /** @public */ export interface ArrayOptions extends SearchConfiguration { list?: TitledListValue[] | V[] - /** - * layout: 'tags' only works for string array - * layout: 'grid' only works for arrays with objects - */ // inferring the array.of value for ArrayDefinition cause too much code-noise and was removed. // Since we don't have the type-info needed here, we allow values - layout?: 'tags' | 'grid' + layout?: 'list' | 'tags' | 'grid' + /** @deprecated This option does not have any effect anymore */ direction?: 'horizontal' | 'vertical' sortable?: boolean modal?: {type?: 'dialog' | 'popover'; width?: number | 'auto'}