Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Dispatch overload to Redux module. #247

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@ export default thunk;
* Redux behaviour changed by middleware, so overloads here
*/
declare module "redux" {
/*
* Overload to add thunk support to Redux's dispatch() function.
* Useful for react-redux or any other library which could use this type.
*/
export interface Dispatch<A extends Action = AnyAction> {
<TReturnType, TState, TExtraThunkArg, TBasicAction extends Action>(
thunk: ThunkAction<TReturnType, TState, TExtraThunkArg, TBasicAction>
): TReturnType;
}

/**
* Overload for bindActionCreators redux function, returns expects responses
* from thunk actions
Expand Down