()
| 67 | } |
| 68 | |
| 69 | function thunk<S, DispatchExt>() { |
| 70 | const thunkMiddleware: Middleware< |
| 71 | ThunkDispatch<S, DispatchExt>, |
| 72 | S, |
| 73 | Dispatch & ThunkDispatch<S> |
| 74 | > = api => next => action => |
| 75 | typeof action === 'function' |
| 76 | ? action(api.dispatch, api.getState) |
| 77 | : next(action) |
| 78 | |
| 79 | return thunkMiddleware |
| 80 | } |
| 81 | |
| 82 | /** |
| 83 | * Middleware that expects exact state type. |