t0gre / react-datepicker

An easily internationalizable, accessible, mobile-friendly datepicker library for the web, build with styled-components.
https://react-datepicker.netlify.com/
MIT License
331 stars 54 forks source link

Wrong Typescript type annotations #138

Closed shafkathullah closed 2 years ago

shafkathullah commented 2 years ago

@datepicker-react/hooks@^2.8.4

Describe the bug Wrong Typescript type annotations

https://codesandbox.io/s/datepickerreacthooks-example-06d

In below screenshot of the sample demo link provided in https://github.com/tomgreenwood1/react-datepicker/tree/master/packages/hooks it shows wrong type annotations making it unusable in .tsx projects, yet the results are correct

Screenshot 2021-11-21 at 9 03 01 PM xk

shafkathullah commented 2 years ago

Its not 'wrong' as I thought, ie, type of day could be number too, so it got solved by narrowing using typeof operator.