mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-25 09:55:15 +00:00
21 lines
624 B
TypeScript
21 lines
624 B
TypeScript
|
import { Middleware, Action, AnyAction } from "redux";
|
||
|
|
||
|
export interface ThunkDispatch<S, E, A extends Action> {
|
||
|
<T extends A>(action: T): T;
|
||
|
<R>(asyncAction: ThunkAction<R, S, E, A>): R;
|
||
|
}
|
||
|
|
||
|
export type ThunkAction<R, S, E, A extends Action> = (
|
||
|
dispatch: ThunkDispatch<S, E, A>,
|
||
|
getState: () => S,
|
||
|
extraArgument: E
|
||
|
) => R;
|
||
|
|
||
|
export type ThunkMiddleware<S = {}, A extends Action = AnyAction, E = undefined> = Middleware<ThunkDispatch<S, E, A>, S, ThunkDispatch<S, E, A>>;
|
||
|
|
||
|
declare const thunk: ThunkMiddleware & {
|
||
|
withExtraArgument<E>(extraArgument: E): ThunkMiddleware<{}, AnyAction, E>
|
||
|
}
|
||
|
|
||
|
export default thunk;
|