Skip to content

selectsMultiple - Type 'boolean | undefined' is not assignable to type 'true'. #6131

@robinmartensss

Description

@robinmartensss

Describe the bug
The bug that was fixed for selectsRange in the last release persist for selectsMultiple, I checked the changes and saw adjustments to the selectsMultiple prop but when you spread DatePickerProps the issue persists.

To Reproduce
Steps to reproduce the behavior:

  1. Send props to component - datePickerProps?: Omit<DatePickerProps, 'onChange'>
  2. Spread props to Datepicker component - {...datePickerProps}
  3. Error is :

Type '{ className: string; children?: ReactNode; date?: Date | undefined; minDate?: Date | undefined; maxDate?: Date | undefined; scrollableYearDropdown?: boolean | undefined; ... 177 more ...; onChange: (date: Date | ... 1 more ... | null) => void; }' is not assignable to type 'IntrinsicAttributes & (IntrinsicClassAttributes & ((Pick<Readonly<Omit<Omit<YearDropdownProps, "date" | ... 3 more ... | "maxDate"> & ... 9 more ... & { ...; }, "className" | ... 18 more ... | "onTimeChange"> & ... 4 more ... & { ...; }>, "className" | ... 137 more ... | "formatMultipleDates"> & InexactP...'.
Type '{ className: string; children?: ReactNode; date?: Date | undefined; minDate?: Date | undefined; maxDate?: Date | undefined; scrollableYearDropdown?: boolean | undefined; ... 177 more ...; onChange: (date: Date | ... 1 more ... | null) => void; }' is not assignable to type 'Pick<Readonly<Omit<Omit<YearDropdownProps, "date" | "onChange" | "year" | "minDate" | "maxDate"> & Omit<MonthDropdownProps, "onChange" | "month"> & ... 10 more ... & { ...; }, "className" | ... 18 more ... | "onTimeChange"> & ... 4 more ... & { ...; }>, "className" | ... 137 more ... | "formatMultipleDates">'.
Types of property 'selectsMultiple' are incompatible.
Type 'boolean | undefined' is not assignable to type 'true'.
Type 'undefined' is not assignable to type 'true'.

Expected behavior
Expectation is that spreading of the props works the same as all the rest.

Screenshots

Image Image

Additional context

4: My temporaty fix is = const extraParameters = useMemo(() => { const parameters: any = {} if (selectsMultiple) { parameters.selectsMultiple = selectsMultiple } return parameters }, [selectsMultiple])

  1. Spread this function to the Datepicker component = {...extraParameters}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions