Skip to content

Commit

Permalink
fix(types): correct ArrayOptions (#6737)
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
christianhg committed May 30, 2024
1 parent 25be802 commit 39da169
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions packages/@sanity/types/src/schema/definition/type/array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@ import {type BaseSchemaDefinition, type SearchConfiguration, type TitledListValu
/** @public */
export interface ArrayOptions<V = unknown> extends SearchConfiguration {
list?: TitledListValue<V>[] | 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'}
Expand Down

0 comments on commit 39da169

Please sign in to comment.