Open endreymarcell opened 1 year ago
Workaround: first save the action into a variable that is explicitly types as any
:
startCountingInterval: async (_unused, thunkAPI) => {
setInterval(() => thunkAPI.dispatch(counterSlice.actions.countIntervalTicked()), 1000);
},
startCountingInterval: async (_unused, thunkAPI) => {
const actionToDispatch: any = counterSlice.actions.countIntervalTicked();
setInterval(() => thunkAPI.dispatch(actionToDispatch), 1000);
},
When reading the state or dispatching an action from within an effect via the
thunkAPI
argument, both the effect inputs and the slice becomeany
because their types depend on each other. Functionality is unaffected.