1.0.1 • Published 5 years ago

babel-plugin-s2s-action-types v1.0.1

Weekly downloads
22
License
MIT
Repository
github
Last release
5 years ago

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 = {
  type: typeof 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 = {
  type: typeof FETCH_REQUEST,
}
export type FetchSuccess = {
  type: typeof FETCH_SUCCESS,
}
export type FetchFailure = {
  type: typeof FETCH_FAILURE,
}

export type Action = FetchRequest | FetchSuccess | FetchFailure
1.0.1

5 years ago

1.0.0

5 years ago

0.4.11

6 years ago

0.4.10

6 years ago

0.4.9

6 years ago

0.4.8

6 years ago

0.4.7

7 years ago

0.4.6

7 years ago

0.4.5

7 years ago

0.4.4

7 years ago

0.4.3

7 years ago

0.4.2

7 years ago

0.4.1

7 years ago

0.4.0

7 years ago

0.3.0

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago