-
Notifications
You must be signed in to change notification settings - Fork 135
Description
🚧 This is a work-in-progress and will be updated as I go. No need for input just yet.
Re https://github.com/react-native-community/discussions-and-proposals/projects/1#card-31965228
Introduction
Improved TypeScript definitions for React Native by converting Flow types automatically.
The Core of It
Thus far, the TS typings for RN have been maintained by hand by third-party community members, in a ‘as needed by maintainers basis’. This means that the typings are generally out-of-date, either removed APIs are still typed or new APIs have not been added yet, or they are plain wrong.
In order to provide a better solution for both MS’ internal needs as well as external TS users; the question posed is, to what extent can we automatically convert the Flow typings to TS? (Some manual massaging of conversion process may be required and is ok, as these could be applied in the form of patches we maintain.)
The Flow team is interested in helping out, where needed. They would like to see an example of the Flow output we’d need; e.g. what comments are preserved, how do we deal with type aliases, imported types (if we are preserving aliases), etc. However, before going down this road, I want to see what prior art exists and if any of these tools is already up for the task (or at least mature enough).
Discussion points
Notes of trying out these tools will be kept here.
-
Khan Academy’s flow-to-ts: Unclear what the original purpose was of the tool, but from the README seems to position itself as wanting to be a maintained tool. It also does some transformations specific to React’s TS typings. At least one person reacted saying that they tested all other offerings and this one being the best. Last work was done the end of 2019.
-
@bcherny & @benjie’s flow2typescript: Was used by @benjie to convert a big project once. Last work was done the end of 2019. -
Quizlet’s babel-plugin-flow-to-typescript: From their blog post it looks like it was meant for a one time conversion. Last work was done the end of 2019. -
@Naturalclar’s f2t : Sounds like it was a one-off conversion tool and seems more naive than the other solutions.