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