Port project to Typescript + Flow Types
See original GitHub issueDescribe the Feature
Since we have been doing a lot of changes to react-native-share
with new documentation and improvements on the example
application, aiming to make the life of any contributor easier.
Following the example of react-navigation which mainly uses TS now, it would simpler to update types, etc.
My idea is porting the main files which are currently written in plain .js
with flow
to ts
. But maintaining the support for flow types. (Any examples are welcome)
Possible Implementations
Firstly, we need to map the common APIs exported from react-native-share
and their respective/expected types. We can use the types from DefinitelyTyped as a start point.
After that, we only need to ensure that the compiled version of these files is working with both ts
, flow
, and js
projects without any drawbacks.
Roadmap
- Port main js files to TS
- Ensure that both
flow
types andts
are supported - Compile project on CI before publish to
npm
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:13 (2 by maintainers)
Another project I check went further without incident - just convert to typescript, evict the flow types and if people want flow-typing they can contribute types to flow-typed repo. It’s basically reversing the previous stance (flow first / typescript secondary) but in a way that - while opinionated - recognizes the current javascript ecosystem reality. Typescript won.
Cool so I think we’re looking for a WIP PR from someone to kickstart this. The main files to migrate would be
let me know if I’m forgetting anything, kinda new to the project.
@MateusAndrade you mentioned refactors, I thought that maybe refactoring would be a different task. Typing first would make refactoring easier later because the compiler would help, just my 2cents here, I could be mistaken 😃
btw index.js doesn’t look that bad to me lol