Closed Ofer-Gal closed 1 day ago
@Ofer-Gal I was able to reproduce it with codesandbox. https://codesandbox.io/p/sandbox/react-datepicker-4945-zkv4ns?file=%2Fsrc%2FApp.tsx%3A14%2C54
Since there are no label props in DatePicker, please remove them or use the appropriate props. https://github.com/Hacker0x01/react-datepicker/blob/main/docs/datepicker.md
Thanks
Describe the bug TypeScript complains about optional properties in VSCode.
To Reproduce
<DatePicker label="Select Start Date/Time (Optional) " elected={startDate} onChange={handleChange} />
Causes TS error:Type '{ label: string; elected: Date; onChange: (date: Date) => void; }' is not assignable to type 'IntrinsicAttributes & (IntrinsicClassAttributes<DatePicker> & (Readonly<DatePickerProps> & Readonly<...>))'. Type '{ label: string; elected: Date; onChange: (date: Date) => void; }' is missing the following properties from type 'Readonly<Omit<React.ComponentPropsWithoutRef<typeof Calendar>, "setOpen" | "dateFormat" | "preSelection" | "onSelect" | "onClickOutside" | "highlightDates" | "holidays" | "shouldFocusDayInline" | "outsideClickIgnoreClass" | ... 11 more ... | "dropdownMode"> & ... 5 more ... & { ...; }>': excludeScrollbar, icon, onSelect, selectsMultiple ts(2322)
Expected behavior A clear and concise description of what you expected to happen. When I use older version, it does not complain. Where the error in new version reaten in TSScreenshots
Desktop (please complete the following information):
Is there esLint override I can use?
Thank you