
| Tech | Version |
|---------------------|---------|
| material-ui-pickers | 3.0.0-alpha.3 |
| material-ui | 4.0.0-beta.0 |
| React | 16.8.2 |
| Browser | Chrome |
| Typescript | 3.3.3333 |
| Peer library | moment 2.24.0 |
Compiles / no TS errors
TS errors with:
Type '{ format: string; id: string; label: Element; onChange: (date: Moment) => void; value: string; }' is missing the following properties from type 'Pick<KeyboardDatePickerProps, "open" | "onAccept" | "okLabel" | "cancelLabel" | "clearLabel" | "todayLabel" | "showTodayButton" | "clearable" | "DialogProps" | "children" | ... 312 more ... | "invalidDateMessage">': onAuxClick, onAuxClickCapturets(2739)
Alas I'm not sure how to make a live demo with a typescript error
My code for reference
<KeyboardDatePicker
format={getLocalDateFormat()}
label={<FormattedMessage id="reports.endDate" />}
onChange={(date: Moment) => dateToUpdate(date)}
value={toDate}
/>
Please checkout this sandbox https://codesandbox.io/s/74wj801koj
Everything works fine without any ts errors. Moreover it is not needed anymore to strictly type (date: Moment) => dateToUpdate()). It will automatically infer the type
I suppose the error coming from version conflict with material-ui or react
Have the same issue and have same versions
I suppose you have outdated @types/react
@dmtrKovalenko I will update my React types and test
Ok, with @types/[email protected] I seem to have cleared that error
Upgrading from @types/[email protected] to @types/[email protected] solves the problem for me too.
Most helpful comment
Upgrading from
@types/[email protected]to@types/[email protected]solves the problem for me too.