Skip to content

Commit 086802a

Browse files
author
Wang Zhongliang
committed
Make TypeScript definition support 4.0.0-beta.2
1 parent 6776450 commit 086802a

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

index.d.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
import {Middleware, Dispatch} from "redux";
1+
import { Middleware, Dispatch, Action, AnyAction } from "redux";
22

33

4-
export type ThunkAction<R, S, E> = (dispatch: Dispatch<S>, getState: () => S,
5-
extraArgument: E) => R;
4+
export type ThunkAction<R, S = {}, E = {}, A extends Action<any> = AnyAction> = (
5+
dispatch: Dispatch<A>,
6+
getState: () => S,
7+
extraArgument: E
8+
) => R;
69

710
declare module "redux" {
8-
export interface Dispatch<S> {
9-
<R, E>(asyncAction: ThunkAction<R, S, E>): R;
11+
export interface Dispatch<A extends Action<any> = AnyAction> {
12+
<R, E>(asyncAction: ThunkAction<R, {}, E, A>): R;
1013
}
1114
}
1215

13-
1416
declare const thunk: Middleware & {
1517
withExtraArgument(extraArgument: any): Middleware;
1618
};

0 commit comments

Comments
 (0)