GithubHelp home page GithubHelp logo

00mjk / flow-to-ts Goto Github PK

View Code? Open in Web Editor NEW

This project forked from khan/flow-to-ts

0.0 0.0 0.0 3.52 MB

Convert flow code to typescript

Home Page: https://flow-to-ts.netlify.com

JavaScript 92.23% HTML 0.20% TypeScript 7.57%

flow-to-ts's Introduction

flow-to-ts

Actions Status codecov npm version

Convert Flow code to TypeScript.

The goal of this project is to provide a tool that can translate 95% of Flow to TypeScript while maintaining a high percentage of the existing type information. We don't want to convert code and end up with everything using any. We also want to avoid having to make a lot of manual changes to files afterwards, e.g. changing SyntheticEvent to React.Event.

Quick start

  • yarn global add @khanacademy/flow-to-ts
  • flow-to-ts [options] <file globs>

For a comprehensive list of available options, please check out the CLI code.

Playground

https://flow-to-ts.netlify.com

Principles

  • when exact translation isn't possible:
    • downgrade to any when possible and provide a gentle warning
    • when it isn't possible to downgrade (e.g. %checks), remove the syntax and provide a forceful warning that the code in question will need a human to convert it manually.
  • best effort to maintain blank lines and the position comments, this isn't always possible so warn in those situations where we can't, e.g. converting object type spreads to intersection types.

Contributing

Bugs

Bug reports for converting Flow to TypeScript should include a link to the playground with an example of a minimal reproducible example of the bug.

Feature Requests

Feature requests are welcome.

Pull Requests

Please make sure there is a GitHub issue first before creating a pull request except for small things. Also, please sign our Contributor License Agreement.

Pull requests that fix a bug in the conversion code should include one or more test cases and should have 100% diff coverage.

Dev quick start

git clone [email protected]:Khan/flow-to-ts.git
cd flow-to-ts
yarn
yarn test

Helpful resources

flow-to-ts's People

Contributors

amarinov avatar amilajack avatar aryzing avatar cuyl avatar davidmh avatar dependabot[bot] avatar gomesalexandre avatar joebowbeer avatar kevinbarabash avatar lautis avatar noppa avatar penx avatar re-fort avatar skovhus avatar spiroka avatar vages avatar vfedyk-lohika avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.