question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Port project to Typescript + Flow Types

See original GitHub issue

Describe 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 and ts are supported
  • Compile project on CI before publish to npm

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
mikehardycommented, Jun 17, 2020

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.

2reactions
tcodes0commented, Jun 18, 2020

Cool so I think we’re looking for a WIP PR from someone to kickstart this. The main files to migrate would be

  • index.js
  • component/Button.js
  • component/Overlay.js
  • component/Sheet.js

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Convert a JavaScript Project With Flow Types to ...
Are you interested in migrating from Flow to TypeScript? Want to update your code incrementally without having to do a total rewrite?
Read more >
Khan/flow-to-ts: Convert flow code to typescript - GitHub
The goal of this project is to provide a tool that can translate 95% of Flow to TypeScript while maintaining a high percentage...
Read more >
Flow to TypeScript migration journey - TkDodo's blog
Move to TypeScript​​ We evaluated flow-to-ts, which could automatically migrate existing flow types to TypeScript. It worked quite well, but a ...
Read more >
Porting 30K Lines of Code from Flow to TypeScript - SingleStore
The engineering team at SingleStore recently ported more than 30000 lines of JavaScript code from type checking with Flow to Typescript.
Read more >
How We Migrated from Javascript and Flow to TypeScript at ...
TS migrate — helps convert JS files to Typescript files. A great introduction can be found here.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found