I have some short code like this:
import { AsyncThunk, createAsyncThunk } from '@reduxjs/toolkit';
export type ThunkCallback = (...any) => Promise<string>;
export default function getCanvasThumbnail(
callback: ThunkCallback,
): AsyncThunk<any, any, any> {
return createAsyncThunk('panel/get-canvas-thumbnail', callback);
}
Doing <any, any, any> gets me past TS up until I do addCase where it won't know that the thunk has .fulfilled or .rejected properties.
The docs say this:
Also, as TS cannot mix explicit and inferred generic parameters, from this point on you'll have to define the Returned and ThunkArg generic parameter as well.
I'm not sure how these are generic if they are what give the rejected and fulfilled properties.
Unsure what to do given it seems these things aren't exported without me re-writing a copy of the interface. I hope I am missing something!