Accessing zod's custom issue params #2013
Unanswered
diegotraid
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a zod schema applied on the useForm hook as a dynamic validator, with superRefine that adds a custom issue as follows:
ctx.AddIssue({ code: 'custom', message: 'Error message', path: ['field'], params: { myCustomErrorType: 1 }})Is there any way to access the
paramsobject on the field's meta?Use case:
I have a field that could cause a number of different errors and, based on the error type, frontend should render different components (for example, a "Force" checkbox to bypass validation on myCustomErrorType === 1)
Hope it's clear. Thanks in advance for any guidance!
Beta Was this translation helpful? Give feedback.
All reactions