# flow-remove-types-no-whitespace

> Removes Flow type annotations from JavaScript files with speed and simplicity.

Latest version **1.0.5** (published 2016-10-04) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install flow-remove-types-no-whitespace
pnpm add flow-remove-types-no-whitespace
yarn add flow-remove-types-no-whitespace
bun add flow-remove-types-no-whitespace
```

Provides the commands `flow-node`, `flow-remove-types`.

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2016-10-04 |
| First published | 2016-09-22 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 464 |
| Author | Lee Byron |
| Maintainers | yyx990803 |
| Keywords | flow, flowtype, compiler, transpiler, transform, es6 |

## Links

- npm: https://www.npmjs.com/package/flow-remove-types-no-whitespace
- Repository: https://github.com/leebyron/flow-remove-types
- Issues: https://github.com/leebyron/flow-remove-types/issues
- npm.io page: https://npm.io/package/flow-remove-types-no-whitespace

## Dependencies (2)

- [babylon](https://npm.io/package/babylon.md) ^6.8.4
- [magic-string](https://npm.io/package/magic-string.md) ^0.16.0

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.0.5 (latest) — 2016-10-04
- 1.0.4 — 2016-09-28
- 1.0.3 — 2016-09-22

## README

flow-remove-types
=================

[![npm](https://img.shields.io/npm/v/flow-remove-types.svg?maxAge=86400)](https://www.npmjs.com/package/flow-remove-types)
[![Build Status](https://img.shields.io/travis/leebyron/flow-remove-types.svg?style=flat&label=travis&branch=master)](https://travis-ci.org/leebyron/flow-remove-types)

Turn your JavaScript with [Flow](https://flowtype.org/) type annotations into
standard JavaScript in an instant with no configuration and minimal setup.

[Flow](https://flowtype.org/) provides static type checking to JavaScript which
can both help find and detect bugs long before code is deployed and can make
code easier to read and more self-documenting. The Flow tool itself only reads
and analyzes code. Running code with Flow type annotations requires first
removing the annotations which are non-standard JavaScript. Typically this is
done via adding a plugin to your [Babel](https://babeljs.io/) configuration,
however Babel may be overkill if you're only targetting modern versions of
Node.js or just not using the modern ES2015 features that may not be in
every browser.

`flow-remove-types` is a faster, simpler, zero-configuration alternative with
minimal dependencies for super-fast `npm install` time.


## Get Started!

Use the command line:

```
npm install --global flow-remove-types
```

```
flow-remove-types --help
flow-remove-types input.js > output.js
```

Or the JavaScript API:

```
npm install flow-remove-types
```

```js
var flowRemoveTypes = require('flow-remove-types');
var fs = require('fs');

var input = fs.readFileSync('input.js', 'utf8');
var output = flowRemoveTypes(input);
fs.writeFileSync('output.js', output);
```


## Use in Build Systems:

**Rollup**: [`rollup-plugin-flow`](https://github.com/leebyron/rollup-plugin-flow)

**Browserify:** [`unflowify`](https://github.com/leebyron/unflowify)


## Use `flow-node`

Wherever you use `node` you can substitute `flow-node` and have a super fast
flow-types aware evaluator or REPL.

```
$ flow-node
> var x: number = 42
undefined
> x
42
```


## Use the require hook

Using the require hook allows you to automatically compile files on the fly when
requiring in node:

```js
require('flow-remove-types/register')
require('./some-module-with-flow-type-syntax')
```


## Dead-Simple Transforms

When `flow-remove-types` removes Flow types, it replaces them with whitespace.
This ensures that the transformed output has exactly the same number of lines
and characters and that all character offsets remain the same. This removes the
need for sourcemaps, maintains legible output, and ensures that it is super easy
to include `flow-remove-types` at any point in your existing build tools.

Built atop the excellent [`babylon`](https://github.com/babel/babylon) parser,
`flow-remove-types` shares the same parse rules as the source of truth as
Flow Babel plugins. It also passes through other common non-standard syntax such
as [JSX](https://facebook.github.io/jsx/) and experimental ECMAScript proposals.

**Before:**

```js
import SomeClass from 'some-module'
import type { SomeInterface } from 'some-module'

export class MyClass<T> extends SomeClass implements SomeInterface {

  value: T

  constructor(value: T) {
    this.value = value
  }

  get(): T {
    return this.value
  }

}

```

**After:**

```js
import SomeClass from 'some-module'


export class MyClass    extends SomeClass                          {



  constructor(value   ) {
    this.value = value
  }

  get()    {
    return this.value
  }

}
```


## Performance

### Install:

Installing via `npm` from an empty project:

**flow-remove-types:**

```
time npm install flow-remove-types

real  0m3.193s
user  0m1.643s
sys   0m0.775s
```

**Babel:**

```
time npm install babel-cli babel-plugin-transform-flow-strip-types

real  0m23.200s
user  0m10.395s
sys   0m4.238s
```

### Transform:

Transforming a directory of 20 files of 100 lines each:

**flow-remove-types:**

```
time flow-remove-types src/ --out-dir dest/

real  0m0.431s
user  0m0.436s
sys   0m0.068s
```

**Babel:**

```
time babel src/ --out-dir dest/

real  0m1.074s
user  0m1.092s
sys   0m0.149s
```

---
_Source: https://npm.io/package/flow-remove-types-no-whitespace · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
