forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
redux-actions.d.ts
34 lines (26 loc) · 1.07 KB
/
redux-actions.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Type definitions for redux-actions v0.8.0
// Project: https://github.com/acdlite/redux-actions
// Definitions by: Jack Hsu <https://github.com/jaysoo>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module ReduxActions {
// FSA-compliant action.
// See: https://github.com/acdlite/flux-standard-action
type Action = {
type: string
payload?: any
error?: boolean
meta?: any
};
type PayloadCreator<T> = (...args: any[]) => T;
type MetaCreator = (...args: any[]) => any;
type Reducer<T> = (state: T, action: Action) => T;
type ReducerMap<T> = {
[actionType: string]: Reducer<T>
};
export function createAction<T>(actionType: string, payloadCreator?: PayloadCreator<T>, metaCreator?: MetaCreator): (...args: any[]) => Action;
export function handleAction<T>(actionType: string, reducer: Reducer<T> | ReducerMap<T>): Reducer<T>;
export function handleActions<T>(reducerMap: ReducerMap<T>, initialState?: T): Reducer<T>;
}
declare module 'redux-actions' {
export = ReduxActions;
}