@@ -43,7 +43,7 @@ export interface Action {
43
43
*
44
44
* @template S State object type.
45
45
*/
46
- export type Reducer < S > = < A extends Action > ( state : S | undefined , action : A ) => S ;
46
+ export type Reducer < S , A extends Action = Action > = ( state : S | undefined , action : A ) => S ;
47
47
48
48
/**
49
49
* Object whose values correspond to different reducer functions.
@@ -93,8 +93,8 @@ export function combineReducers<S>(reducers: ReducersMapObject<S>): Reducer<S>;
93
93
* transform, delay, ignore, or otherwise interpret actions or async actions
94
94
* before passing them to the next middleware.
95
95
*/
96
- export interface Dispatch < S > {
97
- < A extends Action > ( action : A ) : A ;
96
+ export interface Dispatch < TInput = Action , TReturn = Action > {
97
+ ( input : TInput ) : TReturn ;
98
98
}
99
99
100
100
/**
@@ -138,7 +138,7 @@ export interface Store<S> {
138
138
* Note that, if you use a custom middleware, it may wrap `dispatch()` to
139
139
* return something else (for example, a Promise you can await).
140
140
*/
141
- dispatch : Dispatch < S > ;
141
+ dispatch : Dispatch ;
142
142
143
143
/**
144
144
* Reads the state tree managed by the store.
@@ -254,7 +254,7 @@ export const createStore: StoreCreator;
254
254
/* middleware */
255
255
256
256
export interface MiddlewareAPI < S > {
257
- dispatch : Dispatch < S > ;
257
+ dispatch : Dispatch ;
258
258
getState ( ) : S ;
259
259
}
260
260
@@ -267,8 +267,8 @@ export interface MiddlewareAPI<S> {
267
267
* logging actions, performing side effects like routing, or turning an
268
268
* asynchronous API call into a series of synchronous actions.
269
269
*/
270
- export interface Middleware {
271
- < S > ( api : MiddlewareAPI < S > ) : ( next : Dispatch < S > ) => Dispatch < S > ;
270
+ export interface Middleware < S > {
271
+ ( api : MiddlewareAPI < S > ) : ( next : Dispatch ) => Dispatch ;
272
272
}
273
273
274
274
/**
@@ -340,19 +340,19 @@ export interface ActionCreatorsMapObject {
340
340
* creator wrapped into the `dispatch` call. If you passed a function as
341
341
* `actionCreator`, the return value will also be a single function.
342
342
*/
343
- export function bindActionCreators < A extends ActionCreator < any > > ( actionCreator : A , dispatch : Dispatch < any > ) : A ;
343
+ export function bindActionCreators < A extends ActionCreator < any > > ( actionCreator : A , dispatch : Dispatch ) : A ;
344
344
345
345
export function bindActionCreators <
346
346
A extends ActionCreator < any > ,
347
347
B extends ActionCreator < any >
348
- > ( actionCreator : A , dispatch : Dispatch < any > ) : B ;
348
+ > ( actionCreator : A , dispatch : Dispatch ) : B ;
349
349
350
- export function bindActionCreators < M extends ActionCreatorsMapObject > ( actionCreators : M , dispatch : Dispatch < any > ) : M ;
350
+ export function bindActionCreators < M extends ActionCreatorsMapObject > ( actionCreators : M , dispatch : Dispatch ) : M ;
351
351
352
352
export function bindActionCreators <
353
353
M extends ActionCreatorsMapObject ,
354
354
N extends ActionCreatorsMapObject
355
- > ( actionCreators : M , dispatch : Dispatch < any > ) : N ;
355
+ > ( actionCreators : M , dispatch : Dispatch ) : N ;
356
356
357
357
358
358
/* compose */
0 commit comments