Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make optional props actually optional in typescript #68

Closed
wants to merge 1 commit into from
Closed

Make optional props actually optional in typescript #68

wants to merge 1 commit into from

Conversation

mayorandrew
Copy link

Hi there! Thanks for the nice and concise library.
I've been using it in my typescript project and found that some of the optional props are marked as required in the typescript IProps type. So here is the small PR which makes them optional so my JetBrains IDEA won't complain about me not passing them

@mayorandrew
Copy link
Author

Hmm, turns out it's more complicated than simply marking them as optional. Because then typescript complains when the library is built. Going to research that a little bit

@mayorandrew
Copy link
Author

It turns out it is handled by typescript 3.0+ automatically. And my issue with IDE complaining about types is related to the fact that I am directly extending IProps in my component which wraps Range. Seems like I should use custom type for prop type inference for my component, like described here typescript-cheatsheets/react#61 (comment)

Goint to close that PR then, sorry for bothering

@mayorandrew mayorandrew deleted the fix-types branch February 26, 2020 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant