I am using react-datetime
with a react typescript project. I got TS2769 compile eror"
TS2769: No overload matches this call.
Overload 1 of 2, '(props: Readonly<DatetimepickerProps>): ReactDatetimeClass', gave the following error.
Type '(inputDate: Moment) => void' is not assignable to type 'EventOrValueHandler<ChangeEvent<any>>'.
Types of parameters 'inputDate' and 'event' are incompatible.
Type 'string | Moment | ChangeEvent<any>' is not assignable to type 'Moment'.
Type 'string' is not assignable to type 'Moment'.
Overload 2 of 2, '(props: DatetimepickerProps, context?: any): ReactDatetimeClass', gave the following error.
Type '(inputDate: Moment) => void' is not assignable to type 'EventOrValueHandler<ChangeEvent<any>>'.
Following is my code:
...
handleDateChange(inputdate: moment.Moment) {
....
}
<DateTime
timeFormat={false}
viewMode="days"
closeOnSelect
closeOnTab
required
onChange={this.handleDateChange}
/>
I am not sure how to declare the type correct to make it compile. Any can help ?