Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

648
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda