-
Notifications
You must be signed in to change notification settings - Fork 94
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
Typing issue with useAsync and TypeScript #256
Comments
Running in to this as well. Is there something we're missing here? |
I got around this by using the |
The MUI project has a passthru typing that might work here. Their |
I'm not exactly a TypeScript expert. I'd be happy to take a PR to resolve these issues. There's this one still waiting for someone with actual TS knowledge to review it: #247 Oh, the tragedy of converting to TS. Now I'm constantly resolving TS issues without knowing what I'm doing, instead of building new features and improving the lib itself. |
I think api wise it would be better to have in callback separate param between options and context related to the lib |
For those battling with TypeScript support, there is https://www.npmjs.com/package/react-async-hook |
Experiencing TypeScript errors when using
useAsync
version10.0.0
.I feel like I'm probably doing something stupid, but I can replicate and seems like an issue.
Repo demonstrating the issue: https://github.com/samit4me/react-async-ts-issue
Given the data fetching method:
When using
useAsync
via the shorthand method:I get the following error:
When using
useAsync
via the configuration object:I get the following error:
The text was updated successfully, but these errors were encountered: