Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ibqn opened this issue Jun 23, 2023 · 3 comments

Comments

@ibqn
Copy link

ibqn commented Jun 23, 2023

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
Copy link
Owner

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

@sadmann7
Copy link
Owner

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?

@sadmann7 sadmann7 added the good first issue Good for newcomers label Jul 7, 2023
sadmann7 pushed a commit that referenced this issue Jan 27, 2024
@sadmann7 sadmann7 removed the good first issue Good for newcomers label Apr 21, 2024
@Arhan13
Copy link

Arhan13 commented Apr 25, 2024

I am still facing this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants