Replies: 4 comments
-
https://github.com/orgs/react-hook-form/discussions/9325#discussioncomment-4060566 |
Beta Was this translation helpful? Give feedback.
-
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 |
Beta Was this translation helpful? Give feedback.
-
I'm facing this same issue (originally posted here). |
Beta Was this translation helpful? Give feedback.
-
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 } }],
} |
Beta Was this translation helpful? Give feedback.
-
Is your feature request related to a problem? Please describe.
At the moment, when I do something like
@typescript-eslint/no-misused-promises
complains 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
FormSubmitHandler
would be able to infer from the passedSubmitHandler
whether the created callback actually returns aPromise
or not.Describe alternatives you've considered
I either have to disable the eslint rule for that line, or opt for a verbose solution as
Beta Was this translation helpful? Give feedback.
All reactions