Type error when using react-hook-form submit handler

So I'm using react-hook-form with a fresh T3 app, but I'm getting the following error. Has anyone else encountered this?
9 Replies
Brendonovich
Brendonovich2y ago
that's expected, eslint is just being strict on you
shiroyasha9
shiroyasha92y ago
this happens due to a eslint rule, one way i found to bypass it is by creating an anonymous arrow function and marking the function call as void something like this () => void handleSubmit()
jonasmerlin
jonasmerlin2y ago
lol thanks you two! Works even without the void btw. @shiroyasha_
shiroyasha9
shiroyasha92y ago
ah i see, pretty cool
jonasmerlin
jonasmerlin2y ago
Actually, this breaks my Form
Brendonovich
Brendonovich2y ago
oh it would aye, you'd need to do onSubmit={e => handleSubmit(onSubmit)(e)} but that may bring back the original error honestly i'd just turn off the eslint rule or make a custom form component that allows for the correct types
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
jonasmerlin
jonasmerlin2y ago
Thanks for the suggestions! Man, in theory I like this rule but I think I'll just turn it off
whatplan
whatplan2y ago
@jonasmerlin this is so crazy I had litterally the exact same problem, came to the exact same solution (only to find it broke my form) and then found this trying to fix it I also decided to just ignore the rule. Frustrating that making it a IIFE breaks the form, might open a issue on the repo about it.
Want results from more Discord servers?
Add your server