# reasonably-typed

> Converts flow definitions to Bucklescript definitions

Latest version **2.0.0-beta4** (published 2018-06-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install reasonably-typed
pnpm add reasonably-typed
yarn add reasonably-typed
bun add reasonably-typed
```

Provides the command `retyped`.

## Health

**Score 5/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; large bundle.

Negative: insecure dependencies; abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0-beta4 |
| Published | 2018-06-08 |
| First published | 2017-05-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 11 |
| Unpacked size | 10.3 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 517 |
| Author | Ryan Delaney |
| Maintainers | rrdelaney |
| Keywords | Reason, OCaml, Bucklescript, Flow |

## Links

- npm: https://www.npmjs.com/package/reasonably-typed
- Repository: https://github.com/rrdelaney/ReasonablyTyped
- Issues: https://github.com/rrdelaney/ReasonablyTyped/issues
- npm.io page: https://npm.io/package/reasonably-typed

## Dependencies (11)

- [meow](https://npm.io/package/meow.md) ^3.7.0
- [chalk](https://npm.io/package/chalk.md) ^2.1.0
- [reason](https://npm.io/package/reason.md) ^3.1.0
- [graphql](https://npm.io/package/graphql.md) ^0.13.2
- [css-tree](https://npm.io/package/css-tree.md) ^1.0.0-alpha.28
- [prettier](https://npm.io/package/prettier.md) ^1.11.1
- [commander](https://npm.io/package/commander.md) ^2.15.1
- [typescript](https://npm.io/package/typescript.md) ^2.7.2
- [flow-dev-tools](https://npm.io/package/flow-dev-tools.md) github:bsansouci/flow#bsb-support
- [@glennsl/bs-json](https://npm.io/package/@glennsl/bs-json.md) ^2.0.0
- [babel-code-frame](https://npm.io/package/babel-code-frame.md) ^6.26.0

## Recent versions

- 2.0.0-beta4 (latest) — 2018-06-08
- 0.12.0-beta3 (next) — 2017-11-01
- 2.0.0-beta3 — 2018-06-08
- 2.0.0-beta2 — 2018-06-08
- 2.0.0-beta1 — 2018-06-07
- 0.13.0 — 2017-11-22
- 0.12.0 — 2017-11-01
- 0.12.0-beta2 — 2017-11-01
- 0.12.0-beta1 — 2017-11-01
- 0.11.0 — 2017-08-26
- 0.11.0-0 — 2017-08-23
- 0.10.0 — 2017-07-29
- 0.9.0 — 2017-07-06
- 0.8.0 — 2017-07-01
- 0.7.6 — 2017-06-19
- … 16 more at https://npm.io/package/reasonably-typed/versions

## README

<h1 align="center"><img src="https://github.com/rrdelaney/ReasonablyTyped/raw/master/docs/logo.png"></h1>

<pre align="center">
  $ npm install --global reasonably-typed
</pre>

<h4 align="center">
  <i>Converts TypeScript and Flow definitions to Reason interfaces</i>
  <br>
  <i>(Also maybe TypeScript definitions to Flow)</i>
</h4>

<hr>

<h3 align="center">Take your Flow or TypeScript definition</h3>

```js
// 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>

```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

<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:

```js
// 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](DEVELOPING.md) and [CONTRIBUTING](CONTRIBUTING.md).

## Status

[![CircleCI](https://circleci.com/gh/rrdelaney/ReasonablyTyped.svg?style=svg)](https://circleci.com/gh/rrdelaney/ReasonablyTyped)

---
_Source: https://npm.io/package/reasonably-typed · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
