Skip to content

WIP: Improved TypeScript definitions by generating from Flow source. #201

@alloy

Description

@alloy

🚧 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    💡 ProposalThis label identifies a proposal

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions