2.0.0-beta4 • Published 6 years ago
reasonably-typed v2.0.0-beta4
// 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;
}
}
/* 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:
$ retyped my-definition.d.ts
Usage:
$ retyped ...files
Examples:
$ retyped file1.js file2.js file3.d.ts [boolean]
// 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
Development
See DEVELOPING and CONTRIBUTING.
Status
2.0.0-beta4
6 years ago
2.0.0-beta3
6 years ago
2.0.0-beta2
6 years ago
2.0.0-beta1
6 years ago
0.13.0
6 years ago
0.12.0
7 years ago
0.12.0-beta3
7 years ago
0.12.0-beta2
7 years ago
0.12.0-beta1
7 years ago
0.11.0
7 years ago
0.11.0-0
7 years ago
0.10.0
7 years ago
0.9.0
7 years ago
0.8.0
7 years ago
0.7.6
7 years ago
0.7.5
7 years ago
0.7.4
7 years ago
0.7.3
7 years ago
0.7.2
7 years ago
0.7.1
7 years ago
0.7.0
7 years ago
0.6.0
7 years ago
0.5.0
7 years ago
0.4.0
7 years ago
0.3.0
7 years ago
0.2.5
7 years ago
0.2.4
7 years ago
0.2.2
7 years ago
0.2.1
7 years ago
0.2.0
7 years ago
0.1.0
7 years ago