babel-plugin-flow-prepack

0.13.0 • Public • Published

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"]
}

Readme

Keywords

none

Package Sidebar

Install

npm i babel-plugin-flow-prepack

Weekly Downloads

2

Version

0.13.0

License

MIT

Last publish

Collaborators

  • gajus
  • charlespick
  • jedwards1211