Skip to content

Commit 747b488

Browse files
authored
feat: accept readonly array for multiple select value
1 parent 5d472d4 commit 747b488

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/@react-types/select/src/index.d.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@ import {
3232
} from '@react-types/shared';
3333

3434
export type SelectionMode = 'single' | 'multiple';
35-
export type ValueType<M extends SelectionMode> = M extends 'single' ? Key | null : Key[];
35+
export type ValueType<M extends SelectionMode> = M extends 'single' ? Key | null : readonly Key[];
36+
export type ChangeValueType<M extends SelectionMode> = M extends 'single' ? Key | null : Key[];
3637
type ValidationType<M extends SelectionMode> = M extends 'single' ? Key : Key[];
3738

38-
export interface SelectProps<T, M extends SelectionMode = 'single'> extends CollectionBase<T>, Omit<InputBase, 'isReadOnly'>, ValueBase<ValueType<M>>, Validation<ValidationType<M>>, HelpTextProps, LabelableProps, TextInputBase, FocusableProps {
39+
export interface SelectProps<T, M extends SelectionMode = 'single'> extends CollectionBase<T>, Omit<InputBase, 'isReadOnly'>, ValueBase<ValueType<M>, ChangeValueType<M>>, Validation<ValidationType<M>>, HelpTextProps, LabelableProps, TextInputBase, FocusableProps {
3940
/**
4041
* Whether single or multiple selection is enabled.
4142
* @default 'single'

0 commit comments

Comments
 (0)