Skip to content

Commit

Permalink
Use proper dispatch type
Browse files Browse the repository at this point in the history
  • Loading branch information
esamattis committed Sep 13, 2018
1 parent 0696d52 commit 8d3e6b4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/create-thunks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ interface GetState {
(): unknown;
}

interface Thunk {
(dispatch: ReduxDispatch, getState: GetState): any;
}

/**
* For functions return its return type otherwise return void.
*
Expand All @@ -28,9 +32,7 @@ class SimpleStore {
this.dispatch = this.dispatch.bind(this);
}

dispatch<T extends Function | ReduxAction>(
action: T,
): FunctionReturnValue<T> {
dispatch<T extends Thunk | ReduxAction>(action: T): FunctionReturnValue<T> {
const ret = this._reduxDispatch(action);

if (typeof action === "function") {
Expand Down

0 comments on commit 8d3e6b4

Please sign in to comment.