sadmann7 / skateshop

An open source e-commerce skateshop build with everything new in Next.js.
https://skateshop.sadmn.com
MIT License
5.18k stars 743 forks source link

Argument of type '() => Promise<void>' is not assignable to parameter of type 'TransitionFunction' #1

Open ibqn opened 1 year ago

ibqn commented 1 year ago

I have recently discovered that the transition function can not be async according to the docs https://react.dev/reference/react/useTransition#react-doesnt-treat-my-state-update-as-a-transition

startTransition(async () => {
...
}

if you update your typing to the latest version i.e. @types/react": "18.2.14 you should observe this as well.

Argument of type '() => Promise<void>' is not assignable to parameter of type 'TransitionFunction'.
  Type 'Promise<void>' is not assignable to type 'VoidOrUndefinedOnly'
sadmann7 commented 1 year ago

I didn't really know about that. I will fix these tomorrow. Thanks for letting me know

sadmann7 commented 1 year ago

I updated the typing. The error was shown once. After that it is working. Sophie alpert told it will be changed soon.

Is it still erroring for you?

Arhan13 commented 4 months ago

I am still facing this issue