I'm using redux toolkit, and have created a thunk using createAsyncThunk that gets called from a middleware (code below). What is the correct dispatch type? Right now it only works if I specify "any".
import { Action, Dispatch } from "redux";
import { updateTerm } from "../slices/explore";
const middleWare = ({ dispatch }: { dispatch: Dispatch<Action> }) => {
return (next: (action: Action) => void) => {
return (action: Action) => {
next(action);
if (updateTerm.match(action)) {
dispatch<any>(getShows(action.payload));
}
};
};
};
const getShows = createAsyncThunk<
Show[],
string,
{ rejectValue: SearchError }
>("explore/getShows", async (term: string, { rejectWithValue }) => {
//do async stuff
});