Syntax only
This plugin only removes flow types. It doesn't actually check if the types are valid itself. You'll need to use flow itself or a different babel plugin.
输入
function foo(one: any, two: number, three?): string {}
输出
function foo(one, two, three) {}
npm install --save-dev babel-plugin-transform-flow-strip-types
.babelrc
(推荐).babelrc
{
"plugins": ["transform-flow-strip-types"]
}
babel --plugins transform-flow-strip-types script.js
require("babel-core").transform("code", {
plugins: ["transform-flow-strip-types"]
});