Skip to content

Commit

Permalink
Make TypeScript definition support 4.0.0-beta.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Wang Zhongliang committed Feb 27, 2018
1 parent 6776450 commit 086802a
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import {Middleware, Dispatch} from "redux";
import { Middleware, Dispatch, Action, AnyAction } from "redux";


export type ThunkAction<R, S, E> = (dispatch: Dispatch<S>, getState: () => S,
extraArgument: E) => R;
export type ThunkAction<R, S = {}, E = {}, A extends Action<any> = AnyAction> = (
dispatch: Dispatch<A>,
getState: () => S,
extraArgument: E
) => R;

declare module "redux" {
export interface Dispatch<S> {
<R, E>(asyncAction: ThunkAction<R, S, E>): R;
export interface Dispatch<A extends Action<any> = AnyAction> {
<R, E>(asyncAction: ThunkAction<R, {}, E, A>): R;
}
}


declare const thunk: Middleware & {
withExtraArgument(extraArgument: any): Middleware;
};
Expand Down

0 comments on commit 086802a

Please sign in to comment.