flow-remove-types

flow-remove-types

flow-remove-types is a small CLI tool for stripping Flow type annotations from files. It’s a lighter-weight alternative to Babel for projects that don’t need everything Babel provides.

First install flow-remove-types with either Yarn or npm.

yarn add --dev flow-remove-types
# or
npm install --save-dev flow-remove-types

If you then put all your source files in a src directory you can compile them to another directory by running:

yarn run flow-remove-types src/ -D lib/

You can add this to your package.json scripts easily.

{
  "name": "my-project",
  "main": "lib/index.js",
  "scripts": {
    "build": "flow-remove-types src/ -D lib/",
    "prepublish": "yarn run build"
  }
}

Note: You’ll probably want to add a prepublish script that runs this transform as well, so that it runs before you publish your code to the npm registry.

© 2013–present Facebook Inc.
Licensed under the BSD License.
https://flow.org/en/docs/tools/flow-remove-types

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部