Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

641
Vistas
Argument of type '(dispatch: any) => Promise<void>' is not assignable to parameter of type 'AnyAction'

I'm new to the Redux Toolkit, converted my code into that and everything seems fine, but dispatching gives an error:

Argument of type '(dispatch: any) => Promise' is not assignable to parameter of type 'AnyAction'.

Property 'type' is missing in type '(dispatch: any) => Promise' but required in type 'AnyAction'.ts(2345)

This is my store.ts file:

Changing from Redux to Redux Toolkit

But with TypeScript I added like this: https://codesandbox.io/s/stoic-taussig-kl8jt?file=/src/store.ts

Code where I get that 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
            )
          );
        }
      });
    });
  }
};

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda