# babel-plugin-flow2ts

> Babel plugin to convert Flow into TypeScript

Latest version **0.3.0** (published 2018-10-14) · 0 weekly downloads

## Install

```sh
npm install babel-plugin-flow2ts
pnpm add babel-plugin-flow2ts
yarn add babel-plugin-flow2ts
bun add babel-plugin-flow2ts
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2018-10-14 |
| First published | 2018-10-13 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 42.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Daiki Nishikawa |
| Maintainers | nissy |
| Keywords | babel, flow, typescript |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-flow2ts
- Repository: https://github.com/nd-02110114/babel-plugin-flow-to-typescript
- Homepage: https://github.com/nd-02110114/babel-plugin-flow-to-typescript#readme
- Issues: https://github.com/nd-02110114/babel-plugin-flow-to-typescript/issues
- npm.io page: https://npm.io/package/babel-plugin-flow2ts

## Dependencies (3)

- [@babel/core](https://npm.io/package/@babel/core.md) ^7.0.0-beta.44
- [@babel/types](https://npm.io/package/@babel/types.md) ^7.0.0-beta.44
- [@babel/traverse](https://npm.io/package/@babel/traverse.md) ^7.0.0-beta.44

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

- 0.3.0 (latest) — 2018-10-14
- 0.2.0 — 2018-10-13
- 0.1.0 — 2018-10-13

## README

# babel-plugin-flow2ts

[Babel] plugin to convert [Flow] code into [TypeScript]

## How to use

```shell
$ yarn global add @babel/cli
$ yarn add babel-plugin-flow2ts

# you must use babel@^7.x.x
$ babel --version 
7.0.0-beta.44 (@babel/core 7.0.0-beta.44)

$ babel --plugins babel-plugin-flow2ts ${SRC_FLOW_FILE} -o ${DEST_TS_FILE}
```

## Implementation status

| Supported? | Syntax | Flow | TypeScript |
|---|---|---|---|
| ❎ | Maybe type | `let a:?number` | `let a: number \| null \| undefined` |
| ❎ | Void type | `void` | `void` |
| ❎ | Mixed type | `mixed` | `{}` |
| ❎ | Function type | `(A, B) => C` | `(a: A, b: B) => C` |
| ❎ | Exact type | `{\| a: A \|}` | `{ a: A }` |
| ❎ | Indexers | `{ [A]: B }` | `{ [a: A]: B }` |
| ❎ | Existential type | `Map<*, *>` | `Map<any, any>` |
| ❎ | Opaque types | `opaque type A = B` | `type A = B` |
| ❎ | Variance | `interface A { +b: B, -c: C }` | `interface A { readonly b: B, c: C }` |
| ❎ | Type parameter bounds | `function f<A: string>(a:A){}` | `function f<A extends string>(a:A){}` |
| ❎ | Cast | `(a: A)` | `(a as A)` |
| ❎ | type/typeof import | `import type A from 'module'` | `import A from 'module'` |
| ❎ | $Keys | `$Keys<X>` | `keyof X` |
| ❎ | $Values | `$Values<X>` | `X[keyof X]` |
| ❎ | $ReadOnly | `$Readonly<X>` | `Readonly<X>` |
| ❎ | $Exact| `$Exact<X>` | `X` |
| ❎ | $Diff| `$Diff<X, Y>` | `Pick<X, Exclude<keyof X, keyof Y>>` |
| ❎ | $PropertyType| `$PropertyType<T, k>` | `T[k]` |
| ❎ | $ElementType| `$ElementType<T, k>` | `T[k]` |

- [ ] add CLI

[Babel]: https://github.com/babel/babel
[Flow]: https://github.com/facebook/flow
[TypeScript]: https://github.com/Microsoft/TypeScript

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