babel-plugin-s2s-action-types

1.0.1 • Public • Published

babel-plugin-s2s-action-types

generate action types

Install

$ npm install --save-dev babel-plugin-s2s-action-types

Usage

In:

export type Action = Increment

Out:

// @flow
export const INCREMENT: 'app/counter/INCREMENT= 'app/counter/INCREMENT'
 
export const Actions = {
  INCREMENT,
}
 
export type Increment = {
  typetypeof INCREMENT,
}
 
export type Action = Increment

Request/Success/Failure pattern

In:

export type Action = FetchRequest

Out:

export const FETCH_REQUEST: 'app/counter/FETCH_REQUEST=
  'app/counter/FETCH_REQUEST'
export const FETCH_SUCCESS: 'app/counter/FETCH_SUCCESS=
  'app/counter/FETCH_SUCCESS'
export const FETCH_FAILURE: 'app/counter/FETCH_FAILURE=
  'app/counter/FETCH_FAILURE'
 
export const Actions = {
  FETCH_REQUEST,
  FETCH_SUCCESS,
  FETCH_FAILURE,
}
 
export type FetchRequest = {
  typetypeof FETCH_REQUEST,
}
export type FetchSuccess = {
  typetypeof FETCH_SUCCESS,
}
export type FetchFailure = {
  typetypeof FETCH_FAILURE,
}
 
export type Action = FetchRequest | FetchSuccess | FetchFailure

Readme

Keywords

none

Package Sidebar

Install

npm i babel-plugin-s2s-action-types

Weekly Downloads

6

Version

1.0.1

License

MIT

Unpacked Size

19.7 kB

Total Files

6

Last publish

Collaborators

  • akameco