Closed haines closed 1 year ago
remix-validated-form
@remix-validated-form/with-zod
@remix-validated-form/with-yup
zod-form-data
https://github.com/haines/remix-validated-form-onsubmit-subaction
withZod(z.discriminatedUnion("subaction", [...]))
ValidatedForm
subaction
onSubmit
data
The data passed to onSubmit is narrowed to the specific case of the discriminated union based on the subaction
No response
n/a
Related to https://github.com/airjp73/remix-validated-form/issues/270
Thanks for turning that around so quickly! ❤️
Which packages are impacted?
remix-validated-form
@remix-validated-form/with-zod
@remix-validated-form/with-yup
zod-form-data
What version of these packages are you using?
remix-validated-form
: 5.0.0Please provide a link to a minimal reproduction of the issue.
https://github.com/haines/remix-validated-form-onsubmit-subaction
Steps to Reproduce the Bug or Issue
withZod(z.discriminatedUnion("subaction", [...]))
ValidatedForm
using that validator and setting thesubaction
onSubmit
handler and find that thedata
parameter is not narrowed by the subactionExpected behavior
The
data
passed toonSubmit
is narrowed to the specific case of the discriminated union based on the subactionScreenshots or Videos
No response
Platform
n/a
Additional context
Related to https://github.com/airjp73/remix-validated-form/issues/270