@@ -4,16 +4,16 @@ import {
4
4
} from "../../"
5
5
6
6
declare module "../../" {
7
- export interface Dispatch < S > {
8
- < R > ( asyncAction : ( dispatch : Dispatch < S > , getState : ( ) => S ) => R ) : R ;
7
+ export interface Dispatch < D > {
8
+ < R , S > ( asyncAction : ( dispatch : Dispatch < D > , getState : ( ) => S ) => R ) : R ;
9
9
}
10
10
}
11
11
12
- type Thunk < S , O > = ( dispatch : Dispatch < S > , getState ?: ( ) => S ) => O ;
12
+ type Thunk < S , O > = ( dispatch : Dispatch < Action > , getState ?: ( ) => S ) => O ;
13
13
14
14
const thunkMiddleware : Middleware =
15
15
< S > ( { dispatch, getState} : MiddlewareAPI < S > ) =>
16
- ( next : Dispatch < S > ) =>
16
+ ( next : Dispatch < Action > ) =>
17
17
< A extends Action , B > ( action : A | Thunk < S , B > ) : B | Action =>
18
18
typeof action === 'function' ?
19
19
( < Thunk < S , B > > action ) ( dispatch , getState ) :
@@ -51,7 +51,7 @@ const storeWithThunkMiddleware = createStore(
51
51
) ;
52
52
53
53
storeWithThunkMiddleware . dispatch (
54
- ( dispatch : Dispatch < State > , getState : ( ) => State ) => {
54
+ ( dispatch : Dispatch < Action > , getState : ( ) => State ) => {
55
55
const todos : string [ ] = getState ( ) . todos ;
56
56
dispatch ( { type : 'ADD_TODO' } )
57
57
}
0 commit comments