Feature: Support flow types
See original GitHub issueWe’ve started using flow at work and find the static type checking useful.
We’re also using babel-plugin-flow-react-proptypes
, which generates propTypes based on the flow types of a component, which means we don’t need to worry about duplication and the resulting inconsistency.
The nice thing about flow is that it will check at compile time that the props (or function arguments) are being used consistently with their declared types. So, for example, it would flag places where we assume an optional prop is always defined. (react-datepicker has some such cases, especially for props with defaults)
There are two ways we could support flow:
- By adding type declarations but keeping them separate from the code. This would benefit users of the library who use flow.
- By adding flow types within the code. This would help users who use flow in addition to helping us catch bugs within the library itself. Less buggy code would also benefit users who don’t use flow.
Of course, I would prefer option 2. 😃 But I’d like to know there is buy-in before I spend too much time working on it. I can start on some of the smaller subcomponents if you’d like to get an idea of what it would look like.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:9 (4 by maintainers)
https://react.rocks/blog/post/flowtype-continuous-integration/
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.