babel-plugin-flow-prepack
Transforms flow type annotations into prepack __assumeDataProperty() and __abstract() calls.
Last updated 2 years ago by codemix .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install babel-plugin-flow-prepack 
SYNC missed versions from official npm registry.

Babel Plugin Flow Prepack

A babel plugin which transforms Flow annotations into prepack model declarations.

What?

Turns code like this:


type Status = string;

declare var someGlobal: {
  foo: number,
  bar: string,
  status: Status
};

Into code like this:

const Status = 'string';
__assumeDataProperty(global, 'someGlobal', __abstract({
  foo: __abstract('number'),
  bar: __abstract('string'),
  status: __abstract(Status)
}))

So that you can use Flow type annotations to give type hints to prepack.

Installation

npm install --save-dev babel-plugin-flow-prepack

Next, add the following to your babel configuration or .babelrc:

{
  "plugins": ["flow-prepack"]
}

Current Tags

  • 0.13.0                                ...           latest (2 years ago)

2 Versions

  • 0.13.0                                ...           2 years ago
  • 0.11.1                                ...           3 years ago
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 3
Dependencies (6)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |