You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On documentation, on example for Date Picker Dialog with single select, the function "handleDaySelect" has an incorrect interface that causes a typescript error when assigning it to "onSelect" prop on DayPicker component.
2- You will notice the following error on "onSelect":
Type '(date: Date) => void' is not assignable to type 'SelectSingleEventHandler'.
Expected behavior
The code should compile with no type errors.
Suggested fix
I kindly suggest that the type of "handleDaySelect" function to be "SelectSingleEventHandler" and that the "date" parameter receives a "Date | undefined". That solved the error for me:
Bug description
On documentation, on example for Date Picker Dialog with single select, the function "handleDaySelect" has an incorrect interface that causes a typescript error when assigning it to "onSelect" prop on DayPicker component.
To reproduce
1- Copy and paste this code on a React project with dependencies for React DayPicker installed:
https://react-day-picker.js.org/guides/input-fields#example-date-picker-dialog
2- You will notice the following error on "onSelect":
Expected behavior
The code should compile with no type errors.
Suggested fix
I kindly suggest that the type of "handleDaySelect" function to be "SelectSingleEventHandler" and that the "date" parameter receives a "Date | undefined". That solved the error for me:
The fix is basically use the same type as Range example for that function, but with correct EventHandler.
If it is a correct fix and doc website is open to contribute, I would be glad to do it.
The text was updated successfully, but these errors were encountered: