1 | import { Middleware, Action, AnyAction } from "redux";
|
2 |
|
3 | export interface ThunkDispatch<S, E, A extends Action> {
|
4 | <T extends A>(action: T): T;
|
5 | <R>(asyncAction: ThunkAction<R, S, E, A>): R;
|
6 | }
|
7 |
|
8 | export type ThunkAction<R, S, E, A extends Action> = (
|
9 | dispatch: ThunkDispatch<S, E, A>,
|
10 | getState: () => S,
|
11 | extraArgument: E
|
12 | ) => R;
|
13 |
|
14 | export type ThunkMiddleware<S = {}, A extends Action = AnyAction, E = undefined> = Middleware<ThunkDispatch<S, E, A>, S, ThunkDispatch<S, E, A>>;
|
15 |
|
16 | declare const thunk: ThunkMiddleware & {
|
17 | withExtraArgument<E>(extraArgument: E): ThunkMiddleware<{}, AnyAction, E>
|
18 | }
|
19 |
|
20 | export default thunk;
|