ReasonablyTyped is a project that converts Flow and TypeScript type definitions to usable ReasonML and BuckleScript code. It's written primarally in ReasonML itself and compiled with BuckleScript. There's also some small JavaScript wrappers for the command line and the npm library.
It works by parsing a Flow or TypeScript AST, converting it into an intermediate representation, and then printing it as Reason code. There's also a helpful little Flow printer for debugging!
First clone the repo from GitHub, however you see fit. Then make sure you have Node.js and Yarn nstalled on your system, you'll need them for development. You'll also probably want to setup your editor for Reason development, so checkout this guide.
Once all that stuff is installed, run:
$ yarn install
That should install BuckleScript for the project, and all the dependencies ReasonablyTyped needs!
Building the project is fairly easy, thanks to BuckleScript! Just run:
# Once-off builds
$ yarn bsb -clean-world -make-world
# Watch mode
$ yarn bsb -make-world -w
Then you can use the command-line interface to test compile some code:
$ node lib/cli.js ./_test.js --debug
Make sure you have that --debug
flag at the end! It prints out a ton of useful debugging information and makes sure
not to write any files.
Unit and integration testing are done with Jest. To run the tests:
$ yarn test