ReasonablyTyped
:diamond_shape_with_a_dot_inside: Converts Flow and TypeScript definitions to Reason interfaces
Install / Use
/learn @rrdelaney/ReasonablyTypedREADME
// class.js
declare module 'classes' {
declare type State = {
id: number,
storeName: string,
}
declare export class Store {
constructor(initialState: State): Store;
state: State;
update(nextState: State): void;
}
}
<h3 align="center">Run retyped</h3>
<pre align="center">
$ retyped class.js
</pre>
<h3 align="center">Get Reason</h3>
/* 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
<p><details> <summary><b><a href="https://rrdelaney.github.io/ReasonablyTyped">Examples</a></b></summary> </details></p> <p><details> <summary><b>TypeScript</b></summary>TypeScript has a similar workflow. Compile your TypeScript file with:
$ retyped my-definition.d.ts
</details></p>
<p><details>
<summary><b>Command-line Usage</b></summary>
Usage:
$ retyped ...files
Examples:
$ retyped file1.js file2.js file3.d.ts [boolean]
</details></p>
<p><details>
<summary><b>Usage as a library</b></summary>
ReasonablyTyped also exports a library for use! See the example below:
// lib-usage.js
import * as ReasonablyTyped from 'reasonably-typed'
const libSrc = fs.readFileSync('lib.js').toString()
const bsInterface = ReasonablyTyped.compile(libSrc)
format (code: string) => string
Formats a block of code using refmt
compile (code: string, filename?: string) => string
Compiles a libdef, formats the result, and handles errors cleanly
</details></p>Development
See DEVELOPING and CONTRIBUTING.
Status
Related Skills
node-connect
341.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
84.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
Writing Hookify Rules
84.4kThis skill should be used when the user asks to "create a hookify rule", "write a hook rule", "configure hookify", "add a hookify rule", or needs guidance on hookify rule syntax and patterns.
review-duplication
99.5kUse this skill during code reviews to proactively investigate the codebase for duplicated functionality, reinvented wheels, or failure to reuse existing project best practices and shared utilities.
