Skip to content

[select] Canary Release Mis-Types the Multiple Option for Select.Root #2368

@armada-arron

Description

@armada-arron

Bug report

Running on the canary release (as encouraged in this request for multi-select dropdowns: #1956), the multiple prop for Select.Root has the type of true instead of boolean, breaking conditional functionality.

Current behavior

SelectRoot.d.ts exports the following incorrect typing for MultipleProps:

interface MultipleProps<Value> extends Omit<Props<Value>, 'multiple' | 'value' | 'defaultValue' | 'onValueChange'> {
    /**
     * Whether multiple items can be selected.
     * @default false
     */
    multiple: true; 
    value?: Value[] | null;
    defaultValue?: Value[] | null;
    onValueChange?: (value: Value[], event?: Event) => void;
  }

Expected behavior

I would expect the multiple prop to be of type boolean, allowing true/false arguments to be passed. When manually changing this type, the typescript engine accepts expressions in the prop.

interface MultipleProps<Value> extends Omit<Props<Value>, 'multiple' | 'value' | 'defaultValue' | 'onValueChange'> {
    /**
     * Whether multiple items can be selected.
     * @default false
     */
    multiple: boolean;
    value?: Value[] | null;
    defaultValue?: Value[] | null;
    onValueChange?: (value: Value[], event?: Event) => void;
  }

Base UI version

Canary Release (react@9c5f6d4)

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions