@@ -15,8 +15,8 @@ import {
1515 */
1616function logger ( ) {
1717 const loggerMiddleware : Middleware =
18- ( { getState } : MiddlewareAPI ) =>
19- ( next : Dispatch ) =>
18+ ( { getState } ) =>
19+ next =>
2020 action => {
2121 console . log ( 'will dispatch' , action )
2222
@@ -41,9 +41,9 @@ type PromiseDispatch = <T extends Action>(promise: Promise<T>) => Promise<T>
4141
4242function promise ( ) {
4343 const promiseMiddleware : Middleware < PromiseDispatch > =
44- ( { dispatch } : MiddlewareAPI ) =>
44+ ( { dispatch } ) =>
4545 next =>
46- < T extends Action > ( action : AnyAction | Promise < T > ) => {
46+ action => {
4747 if ( action instanceof Promise ) {
4848 action . then ( dispatch )
4949 return action
@@ -72,13 +72,10 @@ function thunk<S, DispatchExt>() {
7272 ThunkDispatch < S , DispatchExt > ,
7373 S ,
7474 Dispatch & ThunkDispatch < S >
75- > =
76- api =>
77- ( next : Dispatch ) =>
78- < R > ( action : AnyAction | Thunk < R , any > ) =>
79- typeof action === 'function'
80- ? action ( api . dispatch , api . getState )
81- : next ( action )
75+ > = api => next => action =>
76+ typeof action === 'function'
77+ ? action ( api . dispatch , api . getState )
78+ : next ( action )
8279
8380 return thunkMiddleware
8481}
@@ -89,14 +86,13 @@ function thunk<S, DispatchExt>() {
8986function customState ( ) {
9087 type State = { field : 'string' }
9188
92- const customMiddleware : Middleware < { } , State > =
93- api => ( next : Dispatch ) => action => {
94- api . getState ( ) . field
95- // @ts -expect-error
96- api . getState ( ) . wrongField
89+ const customMiddleware : Middleware < { } , State > = api => next => action => {
90+ api . getState ( ) . field
91+ // @ts -expect-error
92+ api . getState ( ) . wrongField
9793
98- return next ( action )
99- }
94+ return next ( action )
95+ }
10096
10197 return customMiddleware
10298}
0 commit comments