项目作者: Gozala

项目描述 :
Babel preset for all Flow plugins
高级语言: JavaScript
项目地址: git://github.com/Gozala/babel-preset-flow-syntax.git
创建时间: 2017-06-23T22:30:16Z
项目社区:https://github.com/Gozala/babel-preset-flow-syntax

开源协议:

下载


babel-preset-flow-syntax

This is an extension of the official flow that is supposly is a:

Babel preset for all Flow plugins.

But there are certain features like class properties syntax that flow
supports out of the box while babel requires transform-class-properties
plugin in order to be able to parse it.

Babel preset that supports full flow syntax.

This preset includes the following plugins & presets:

Example

In

  1. function foo(one: any, two: number, three?): string {}

Out

  1. function foo(one, two, three) {}

Installation

  1. npm install --save-dev babel-preset-flow-syntax

Usage

.babelrc

  1. {
  2. "presets": ["flow-sytax"]
  3. }

Via CLI

  1. babel --presets flow-syntax script.js

Via Node API

  1. require("babel-core").transform("code", {
  2. presets: ["flow-syntax"]
  3. });