$ npm install --global reasonably-typed
Converts TypeScript and Flow definitions to Reason interfaces
(Also maybe TypeScript definitions to Flow)
Take your Flow or TypeScript definition
// class.jsdeclare module 'classes' declare type State = id: number storeName: string declare : Store; state: State; update(nextState: State): void; }
Run retyped
$ retyped class.js
Get Reason
/* Module classes */ type state = {. "id": float, "storeName": string };module Store = { type t = {. "state": (state), "update": [@bs.meth](state => unit)}; [@bs.new] [@bs.module "classes"] external make : state => t = "Store";};
Docs
TypeScript has a similar workflow. Compile your TypeScript file with:TypeScript
$ retyped my-definition.d.ts
Command-line Usage
Usage:
$ retyped ...files
Examples:
$ retyped file1.js file2.js file3.d.ts [boolean]
Formats a block of code using Compiles a libdef, formats the result, and handles errors cleanlyUsage as a library
ReasonablyTyped also exports a library for use! See the example below:
format (code: string) => string
refmt
compile (code: string, filename?: string) => string
Development
See DEVELOPING and CONTRIBUTING.