javascript - El argumento de tipo '(dispatch: any) => Promise' no se puede asignar al parámetro de tipo 'AnyAction'
Soy nuevo en Redux Toolkit, convertí mi código a eso y todo parece estar bien, pero al hacer dispatch da un error:
El argumento de tipo '(dispatch: any) => Promise' no es asignable al parámetro de tipo 'AnyAction'.
La propiedad 'type' falta en el tipo '(dispatch: any) => Promise' pero es requerida en el tipo 'AnyAction'.ts(2345)
Este es mi archivo store.ts:
Cambiar de Redux a Redux Toolkit
Pero con TypeScript lo agregué así: https://codesandbox.io/s/stoic-taussig-kl8jt?file=/src/store.ts
Código donde obtengo ese error:
const dispatch = useAppDispatch();
const loadGraph = () => {
if (currentSite) {
dispatch(getFloor(currentSite.identifier)).then(() => {
console.log("Fetched floorplan");
dispatch(getGraph(currentSite.identifier)).then(() => {
console.log("Fetched model", realGraph.model);
if (currentCamera) {
dispatch(
changeActiveCamera(
currentSite.identifier,
currentCamera.identifier
)
);
}
});
});
}
};