Type error: Type '(event: Date | ChangeEvent<Element>) => void' is not assignable to type 'SelectSingleEventHandler'. Types of parameters 'event' and 'day' are incompatible. Type 'Date | undefined' is not assignable to type 'Date | ChangeEvent<Element>'. Type 'undefined' is not assignable to type 'Date | ChangeEvent<Element>'.
Type error: Type '(event: Date | ChangeEvent<Element>) => void' is not assignable to type 'SelectSingleEventHandler'. Types of parameters 'event' and 'day' are incompatible. Type 'Date | undefined' is not assignable to type 'Date | ChangeEvent<Element>'. Type 'undefined' is not assignable to type 'Date | ChangeEvent<Element>'.
Hey there. Been getting this error working with the Calendar component he has. Been getting this build error in Vercel, whereas in vscode I'm getting a build passed. Anyone have any idea? See code in the comments.
Solution
fixed, just had to switch from
onSelect={field.onChange}
onSelect={field.onChange}
to
onSelect={field.onChange as unknown as SelectSingleEventHandler | undefined}
onSelect={field.onChange as unknown as SelectSingleEventHandler | undefined}