Skip to content

Commit 95369c7

Browse files
committed
Build typings
1 parent 34967bf commit 95369c7

File tree

1 file changed

+11
-21
lines changed

1 file changed

+11
-21
lines changed

lib/index.d.ts

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
export interface AnyAction {
22
type: any;
33
}
4+
export declare type Meta = null | {
5+
[key: string]: any;
6+
};
47
export interface Action<P> extends AnyAction {
58
type: string;
69
payload: P;
710
error?: boolean;
8-
meta?: Object | null;
11+
meta?: Meta;
912
}
1013
export interface Success<P, S> {
1114
params: P;
@@ -18,35 +21,22 @@ export interface Failure<P, E> {
1821
export declare function isType<P>(action: AnyAction, actionCreator: ActionCreator<P>): action is Action<P>;
1922
export interface ActionCreator<P> {
2023
type: string;
21-
(payload: P, meta?: Object | null): Action<P>;
24+
(payload: P, meta?: Meta): Action<P>;
2225
}
2326
export interface EmptyActionCreator extends ActionCreator<undefined> {
24-
(payload?: undefined, meta?: Object | null): Action<undefined>;
27+
(payload?: undefined, meta?: Meta): Action<undefined>;
2528
}
2629
export interface AsyncActionCreators<P, S, E> {
2730
type: string;
2831
started: ActionCreator<P>;
2932
done: ActionCreator<Success<P, S>>;
3033
failed: ActionCreator<Failure<P, E>>;
3134
}
32-
export interface EmptySuccess<S> {
33-
result: S;
34-
}
35-
export interface EmptyFailure<E> {
36-
error: E;
37-
}
38-
export interface EmptyAsyncActionCreators<S, E> {
39-
type: string;
40-
started: EmptyActionCreator;
41-
done: ActionCreator<EmptySuccess<S>>;
42-
failed: ActionCreator<EmptyFailure<E>>;
43-
}
4435
export interface ActionCreatorFactory {
45-
(type: string, commonMeta?: Object | null, error?: boolean): EmptyActionCreator;
46-
<P>(type: string, commonMeta?: Object | null, isError?: boolean): ActionCreator<P>;
47-
<P>(type: string, commonMeta?: Object | null, isError?: (payload: P) => boolean): ActionCreator<P>;
48-
async<P, S>(type: string, commonMeta?: Object | null): AsyncActionCreators<P, S, any>;
49-
async<undefined, S, E>(type: string, commonMeta?: Object | null): EmptyAsyncActionCreators<S, E>;
50-
async<P, S, E>(type: string, commonMeta?: Object | null): AsyncActionCreators<P, S, E>;
36+
(type: string, commonMeta?: Meta, error?: boolean): EmptyActionCreator;
37+
<P>(type: string, commonMeta?: Meta, isError?: boolean): ActionCreator<P>;
38+
<P>(type: string, commonMeta?: Meta, isError?: (payload: P) => boolean): ActionCreator<P>;
39+
async<P, S>(type: string, commonMeta?: Meta): AsyncActionCreators<P, S, any>;
40+
async<P, S, E>(type: string, commonMeta?: Meta): AsyncActionCreators<P, S, E>;
5141
}
5242
export default function actionCreatorFactory(prefix?: string | null, defaultIsError?: (payload: any) => boolean): ActionCreatorFactory;

0 commit comments

Comments
 (0)