Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/@react-types/combobox/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import {
export type MenuTriggerAction = 'focus' | 'input' | 'manual';
export type SelectionMode = 'single' | 'multiple';
export type ValueType<M extends SelectionMode> = M extends 'single' ? Key | null : Key[];
type ValidationType<M extends SelectionMode> = M extends 'single' ? Key : Key[];
type ValidationType<M extends SelectionMode> = M extends 'single' ? Key | null : Key[];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems incorrect, null should not be allowed. it's considered valid unless marked required in which case required validation will take care of it

if the assertion that allowsCustomValue can be called with null, then that seems like a bug


export interface ComboBoxValidationValue<M extends SelectionMode = 'single'> {
/**
Expand All @@ -50,7 +50,7 @@ export interface ComboBoxValidationValue<M extends SelectionMode = 'single'> {
inputValue: string
}

export interface ComboBoxProps<T, M extends SelectionMode = 'single'> extends CollectionBase<T>, InputBase, ValueBase<ValueType<M>>, TextInputBase, Validation<ComboBoxValidationValue>, FocusableProps<HTMLInputElement>, LabelableProps, HelpTextProps {
export interface ComboBoxProps<T, M extends SelectionMode = 'single'> extends CollectionBase<T>, InputBase, ValueBase<ValueType<M>>, TextInputBase, Validation<ComboBoxValidationValue<M>>, FocusableProps<HTMLInputElement>, LabelableProps, HelpTextProps {
/** The list of ComboBox items (uncontrolled). */
defaultItems?: Iterable<T>,
/** The list of ComboBox items (controlled). */
Expand Down