-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
I just updated the React Date Picker to the latest version, but I'm encountering type errors that I can't resolve. I'm using @types/react@19.0.8
my component:
"use client"
import { localeDateFormat } from "@/lite/services/utils/formats"
import classNames from "classnames"
import DatePicker, { DatePickerProps } from "react-datepicker"
type IReportBuilderOptionsDateInput = {
id: string
label?: string
value: Date | null
placeholder?: string
className?: string
inputClassName?: string
labelClassName?: string
onChange: DatePickerProps["onChange"]
}
const ReportBuilderOptionsDateInput = (
props: IReportBuilderOptionsDateInput
) => {
const {
id,
className,
inputClassName,
label,
labelClassName,
placeholder,
value,
onChange
} = props
return (
<label
htmlFor={id}
className={classNames(
"input input-sm input-bordered my-1 flex items-center gap-2",
className
)}
>
<DatePicker
id={id}
selected={value || null}
onChange={onChange} <------------------------ TYPE ERROR HERE !!!!!
placeholderText={placeholder}
dateFormat={localeDateFormat}
className={classNames("grow bg-transparent", inputClassName)}
/>
{label && (
<span className={classNames("badge badge-primary", labelClassName)}>
{label}
)}
)
}
export default ReportBuilderOptionsDateInput
the error is:
Type '{ id: string; selected: Date | null; onChange: ((date: Date | null, event?: MouseEvent<HTMLElement, MouseEvent> | KeyboardEvent<HTMLElement> | undefined) => void) | ((date: [...], event?: MouseEvent<...> | ... 1 more ... | undefined) => void) | ((date: Date[] | null, event?: MouseEvent<...> | ... 1 more ... | undefi...' is not assignable to type 'IntrinsicAttributes & (IntrinsicClassAttributes<DatePicker> & ((Pick<Readonly<Omit<Omit<YearDropdownProps, "date" | ... 3 more ... | "maxDate"> & ... 9 more ... & { ...; }, "dropdownMode" | ... 19 more ... | "onTimeChange"> & ... 4 more ... & { ...; }>, "date" | ... 121 more ... | "onChangeRaw"> & InexactPartial<......'. Property 'selectsMultiple' is missing in type '{ id: string; selected: Date | null; onChange: ((date: Date | null, event?: MouseEvent<HTMLElement, MouseEvent> | KeyboardEvent<HTMLElement> | undefined) => void) | ((date: [...], event?: MouseEvent<...> | ... 1 more ... | undefined) => void) | ((date: Date[] | null, event?: MouseEvent<...> | ... 1 more ... | undefi...' but required in type 'Pick<Readonly<Omit<Omit<YearDropdownProps, "date" | "onChange" | "year" | "minDate" | "maxDate"> & Omit<MonthDropdownProps, "onChange" | "month"> & ... 10 more ... & { ...; }, "dropdownMode" | ... 19 more ... | "onTimeChange"> & ... 4 more ... & { ...; }>, "date" | ... 121 more ... | "onChangeRaw">'.ts(2322) index.d.ts(96, 5): 'selectsMultiple' is declared here.