-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
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:
- Send props to component -
datePickerProps?: Omit<DatePickerProps, 'onChange'> - Spread props to Datepicker component -
{...datePickerProps} - 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
Additional context
4: My temporaty fix is = const extraParameters = useMemo(() => { const parameters: any = {} if (selectsMultiple) { parameters.selectsMultiple = selectsMultiple } return parameters }, [selectsMultiple])
- Spread this function to the Datepicker component =
{...extraParameters}