Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

642
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!