Usage: npm install && npm test
Goal: remove as any
from this line in example.ts
:
store.dispatch(thunkedAction(1) as any);
Good luck!
Trying to augment the module as below masks the type information from
node_modules/redux/index.d.ts
, leading to errors importing Middleware
and Dispatch
from redux
because they no longer exist:
// add to redux-thunk.d.ts
// or put in its own .d.ts file:
declare module 'redux' {
export interface Dispatch<S> {
<R>(thunkAction: ThunkInterface<R>): R;
}
}