<commit_before># ReasonablyTyped

> Converts Flow library definitions to Bucklescript interfaces

# Installation

```
$ npm install --global reasonably-typed
```

# Usage

```
retyped

Commands:
  compile [files...]  Generate BuckleScript interfaces from a file

Options:
  --version     Show version number                                    [boolean]
  --no-fmt      Don't run the resulting code through refmt             [boolean]
  --help        Show help                                              [boolean]
```

This will generate a Bucklescript interface file for every library definition given. For example,
to generate interfaces from flow-typed, run:

```
$ retyped compile --flow-typed
```

For a single file, run:

```
$ retyped compile my-flow-lib.js
```

See the example directory for usage details.

For more information, run with `--help`.

# Usage as a library

ReasonablyTyped also exports a library for use! See the example below:

```js
// lib-usage.js
import * as ReasonablyTyped from 'reasonably-typed'

const libName = 'lib.js'
const libSrc = fs.readFileSync(libName).toString()
const bsInterface = ReasonablyTyped.compile(libName, libSrc)
```

### `compile (fileName: string, fileSource: string) => string`

Compiles a given Flow library definition to a Bucklescript interface.
This function only cares about _transforming_ the source, and doesn't write anything.

### `refmt (code: string, inFile: 'RE' | 'ML', fileType: 'interface' | 'implementation', outFile: 'RE' | 'ML') => string`

Formats a block of code using `refmt`

### `compileSource (code: string) => string`

Compiles a libdef, formats the result, and handles errors cleanly

# Roadmap

- [x] Basic types like `string`
- [x] Function types
- [x] Record types
- [ ] Literals as types
- [x] Union types
- [ ] Instersection types
- [x] Named types
- [ ] Classes
- [ ] Generics
- [ ] Built-ins like Promises and React
<commit_msg>Update documentation in README<commit_after># ReasonablyTyped

> Converts Flow library definitions to Bucklescript interfaces

# Installation

```
$ npm install --global reasonably-typed
```

# Usage

```
retyped

Commands:
  compile [files...]  Generate BuckleScript interfaces from a file

Options:
  --version     Show version number                                    [boolean]
  --no-fmt      Don't run the resulting code through refmt             [boolean]
  --help        Show help                                              [boolean]
```

This will generate a Bucklescript interface file for every library definition given. For example,
to generate interfaces from flow-typed, run:

```
$ retyped compile --flow-typed
```

For a single file, run:

```
$ retyped compile my-flow-lib.js
```

See the example directory for usage details.

For more information, run with `--help`.

# Usage as a library

ReasonablyTyped also exports a library for use! See the example below:

```js
// lib-usage.js
import * as ReasonablyTyped from 'reasonably-typed'

const libName = 'lib.js'
const libSrc = fs.readFileSync(libName).toString()
const bsInterface = ReasonablyTyped.compile(libName, libSrc)
```

### `rawCompile (fileName: string, fileSource: string) => string`

Compiles a given Flow library definition to a Bucklescript interface.
This function only cares about _transforming_ the source, and doesn't write anything.

### `refmt (code: string, inFile: 'RE' | 'ML', fileType: 'interface' | 'implementation', outFile: 'RE' | 'ML') => string`

Formats a block of code using `refmt`

### `compile (code: string) => string`

Compiles a libdef, formats the result, and handles errors cleanly

# Roadmap

- [x] Basic types like `string`
- [x] Function types
- [x] Record types
- [ ] Literals as types
- [x] Union types
- [ ] Instersection types
- [x] Named types
- [ ] Classes
- [ ] Generics
- [ ] Built-ins like Promises and React

{'fraction_non_alphanumeric': 0.10712428497139885, 'fraction_numerical': 0.0, 'mean_word_length': 3.236784140969163, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5668343', 'n_tokens_mistral': 1146, 'n_tokens_neox': 1102, 'n_words': 427}