babel-plugin-define-undefined-type
Define string literal type when you write undefined type.
Install
$ npm install --save-dev babel-plugin-define-undefined-type
Usage
Examples
General
In:
type X = A;
Out:
type A = "A";type X = A;
Union
In:
type Action = type: ADD | INCREMENT ;
Out:
type ADD = "ADD";type INCREMENT = "INCREMENT";type Action = type: ADD | INCREMENT ;
In:
type Action = type: ADD | type: INCREMENT
Out:
type ADD = "ADD";type INCREMENT = "INCREMENT";type Action = type: ADD | type: INCREMENT ;
Options
usePrefix
type: boolean
Default: false
Prefix of the file path.
Example
.babelrc
In:
type Action = type: ADD | type: INCREMENT
Out:
type ADD = "app/counter/ADD";type INCREMENT = "app/counter/INCREMENT";type Action = type: ADD | type: INCREMENT ;
removePrefix
type: string
Default: ''
Example
.babelrc
In:
type Action = type: ADD | type: INCREMENT
Out:
type ADD = "counter/ADD";type INCREMENT = "counter/INCREMENT";type Action = type: ADD | type: INCREMENT ;
License
MIT © akameco