- Notifications
You must be signed in to change notification settings - Fork24
💠 Converts Flow and TypeScript definitions to Reason interfaces
License
NotificationsYou must be signed in to change notification settings
rrdelaney/ReasonablyTyped
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
$ npm install --global reasonably-typed
Converts TypeScript and Flow definitions to Reason interfaces
(Also maybe TypeScript definitions to Flow)
// class.jsdeclaremodule'classes'{declaretypeState={id:number,storeName:string,}declareexportclassStore{constructor(initialState:State):Store;state:State;update(nextState:State):void;}}
$ retyped class.js
/* Module classes*/typestate= {. "id":float, "storeName":string };moduleStore= {typet= {. "state": (state), "update": [@bs.meth](state =>unit)}; [@bs.new] [@bs.module"classes"]externalmake:state =>t="Store";};
TypeScript
TypeScript has a similar workflow. Compile your TypeScript file with:
$ retyped my-definition.d.tsCommand-line Usage
Usage: $ retyped ...filesExamples: $ retyped file1.js file2.js file3.d.ts [boolean]Usage as a library
ReasonablyTyped also exports a library for use! See the example below:// lib-usage.jsimport*asReasonablyTypedfrom'reasonably-typed'constlibSrc=fs.readFileSync('lib.js').toString()constbsInterface=ReasonablyTyped.compile(libSrc)
format (code: string) => string
Formats a block of code usingrefmt
compile (code: string, filename?: string) => string
Compiles a libdef, formats the result, and handles errors cleanly
SeeCONTRIBUTING.
About
💠 Converts Flow and TypeScript definitions to Reason interfaces
Topics
Resources
License
Code of conduct
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.
Contributors9
Uh oh!
There was an error while loading.Please reload this page.
