Mis-Used Promise ESLINT

Anyone know how to correct this without telling Eslint to ignore? <form // eslint-disable-next-line @typescript-eslint/no-misused-promises onSubmit={methods.handleSubmit(async (values) => { await mutation.mutateAsync(values); methods.reset(); })} className="space-y-2" > I can't tell the onSubmit that handleSubmit is void because then the validation doesn't take place.
3 Replies
JulieCezar
JulieCezar2y ago
Maybe try to extract the method before that and type it out?
const myMethod: () => void = methods.handleSubmit;

or

const myMethod = methods.handleSubmit as () => void ;
const myMethod: () => void = methods.handleSubmit;

or

const myMethod = methods.handleSubmit as () => void ;
iDarkLightning
Well handle the promise properly then catch
whatplan
whatplan2y ago
this or onClick={() => void functionWithPromise()}
Want results from more Discord servers?
Add your server