1
- # Redux TypeScript Actions [ ![ npm version] [ npm-image ]] [ npm-url ] [ ![ Build Status] [ travis-image ]] [ travis-url ]
1
+ # TypeScript FSA [ ![ npm version] [ npm-image ]] [ npm-url ] [ ![ Build Status] [ travis-image ]] [ travis-url ]
2
2
3
3
A simple Action Creator library for TypeScript. Its goal is to provide simple
4
- yet type-safe experience with Redux actions.
4
+ yet type-safe experience with Flux actions.
5
5
Created actions are FSA-compliant:
6
6
7
7
``` ts
@@ -16,15 +16,15 @@ interface Action<P> {
16
16
## Installation
17
17
18
18
```
19
- npm install --save redux- typescript-actions
19
+ npm install --save typescript-fsa
20
20
```
21
21
22
22
## Usage
23
23
24
24
### Basic
25
25
26
26
``` ts
27
- import actionCreatorFactory from ' redux- typescript-actions ' ;
27
+ import actionCreatorFactory from ' typescript-fsa ' ;
28
28
29
29
const actionCreator = actionCreatorFactory ();
30
30
@@ -45,7 +45,7 @@ Async Action Creators are objects with properties `started`, `done` and
45
45
` failed ` whose values are action creators.
46
46
47
47
``` ts
48
- import actionCreatorFactory from ' redux- typescript-actions ' ;
48
+ import actionCreatorFactory from ' typescript-fsa ' ;
49
49
50
50
const actionCreator = actionCreatorFactory ();
51
51
@@ -86,7 +86,7 @@ convenient to keep actions near the component that dispatches them.
86
86
87
87
` ` ` ts
88
88
// MyComponent.actions.ts
89
- import actionCreatorFactory from ' redux- typescript-actions ' ;
89
+ import actionCreatorFactory from ' typescript-fsa ' ;
90
90
91
91
const actionCreator = actionCreatorFactory (' MyComponent' );
92
92
@@ -97,11 +97,11 @@ console.log(action);
97
97
// {type: 'MyComponent/SOMETHING_HAPPENED', payload: {foo: 'bar'}}
98
98
` ` `
99
99
100
- ### Reducers
100
+ ### Redux
101
101
102
102
` ` ` ts
103
103
// actions.ts
104
- import actionCreatorFactory from ' redux- typescript-actions ' ;
104
+ import actionCreatorFactory from ' typescript-fsa ' ;
105
105
106
106
const actionCreator = actionCreatorFactory ();
107
107
@@ -110,13 +110,13 @@ export const somethingHappened =
110
110
111
111
112
112
// reducer.ts
113
- import {Action as ReduxAction } from ' redux' ;
114
- import {isType , Action } from ' redux- typescript-actions ' ;
113
+ import {Action } from ' redux' ;
114
+ import {isType } from ' typescript-fsa ' ;
115
115
import {somethingHappened } from ' ./actions' ;
116
116
117
117
type State = {bar: string };
118
118
119
- const reducer = (state : State , action : ReduxAction ): State => {
119
+ const reducer = (state : State , action : Action ): State => {
120
120
if (isType (action , somethingHappened )) {
121
121
// action.payload is inferred as {foo: string};
122
122
@@ -154,7 +154,7 @@ if (isType(action, somethingHappened)) {
154
154
}
155
155
` ` `
156
156
157
- [npm-image]: https://badge.fury.io/js/redux- typescript-actions .svg
158
- [npm-url]: https://badge.fury.io/js/redux- typescript-actions
159
- [travis-image]: https://travis-ci.org/aikoven/redux- typescript-actions .svg?branch=master
160
- [travis-url]: https://travis-ci.org/aikoven/redux- typescript-actions
157
+ [npm-image]: https://badge.fury.io/js/typescript-fsa .svg
158
+ [npm-url]: https://badge.fury.io/js/typescript-fsa
159
+ [travis-image]: https://travis-ci.org/aikoven/typescript-fsa .svg?branch=master
160
+ [travis-url]: https://travis-ci.org/aikoven/typescript-fsa
0 commit comments