forked from aikoven/typescript-fsa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
31 lines (31 loc) · 983 Bytes
/
index.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
import { Action as ReduxAction } from "redux";
export interface Action<P> extends ReduxAction {
type: string;
payload: P;
error?: boolean;
meta?: Object;
}
export interface Success<P, S> {
params: P;
result: S;
}
export interface Failure<P, E> {
params: P;
error: E;
}
export declare function isType<P>(action: ReduxAction, actionCreator: ActionCreator<P>): action is Action<P>;
export interface ActionCreator<P> {
type: string;
(payload: P, meta?: Object): Action<P>;
}
export interface AsyncActionCreators<P, S, E> {
type: string;
started: ActionCreator<P>;
done: ActionCreator<Success<P, S>>;
failed: ActionCreator<Failure<P, E>>;
}
export interface ActionCreatorFactory {
<P>(type: string, commonMeta?: Object, error?: boolean): ActionCreator<P>;
async<P, S, E>(type: string, commonMeta?: Object): AsyncActionCreators<P, S, E>;
}
export default function actionCreatorFactory(prefix?: string): ActionCreatorFactory;