Replies: 6 comments
|
https://github.com/orgs/react-hook-form/discussions/9325#discussioncomment-4060566 |
|
Thanks for the fast response! This feature sounds helpful, but I'm still wondering whether that's the best way to settle the issue. If it was possible that |
|
I'm facing this same issue (originally posted here). |
|
FWIW, @typescript-eslint/no-misused-promises has rule exceptions setup specifically for JSX void promises like this, so disabling the rule for cases where a void promise is passed as an attribute to a JSX element (like this) can "fix" the problem. "rules": {
// ...
"@typescript-eslint/no-misused-promises": ["error", { "checksVoidReturn": { "attributes": false } }],
} |
|
Disabling the linting rule can affect other parts of the code, not just this one related to What is the reason for returning a |
|
Any update on this ? 2 years later facing the same isssue |
Uh oh!
There was an error while loading. Please reload this page.
Is your feature request related to a problem? Please describe.
At the moment, when I do something like
@typescript-eslint/no-misused-promisescomplains that:"Promise-returning function provided to attribute where a void return was expected.". But since my function doesn't return aPromise, that's not actually not the case here. The assumption comes from the typeUseFormHandleSubmit, which returns a function with its result being justPromise<void>anyway.Describe the solution you'd like
It would be great if the return value of
FormSubmitHandlerwould be able to infer from the passedSubmitHandlerwhether the created callback actually returns aPromiseor not.Describe alternatives you've considered
I either have to disable the eslint rule for that line, or opt for a verbose solution as
All reactions