You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The onPress handler on Button component has a return type of void however many tasks done using buttons can be asynchronous and the expect the type of promise returning function.
🔦 Context
Faced this issue when calling an API with a function and es-lint was throwing the following error:
I tried broadening the the onPress return type to void | Promise<void> but this seems to have some known issues that would make it a no go it seems. Perhaps changing the return type to unknown?
I don't think we necessarily need to change anything, this is apparent in React as well. typescript-eslint/typescript-eslint#4619 The recommendation is that when using React, make use of the options to turn off certain checks. Specifically checksVoidReturn. Going to close with the official recommendation. We can reopent if that changes down the road.
📝 Feedback
The onPress handler on Button component has a return type of void however many tasks done using buttons can be asynchronous and the expect the type of promise returning function.
🔦 Context
Faced this issue when calling an API with a function and es-lint was throwing the following error:
💻 Code Sample
🌍 Your Environment
| react-aria-components |
| Edge Chromium |
| Windows 11 |
🧢 Your Company/Team
Independent Developer
The text was updated successfully, but these errors were encountered: