Replies: 1 comment 5 replies
-
I'm in the same situation right now, trying to set a |
Beta Was this translation helpful? Give feedback.
-
I'm in the same situation right now, trying to set a |
Beta Was this translation helpful? Give feedback.
-
I'm trying to validate
defaultValues
with Zod and set empty (null
/undefined
) values to their respectful defaults via.default()
method as described in the.default
section of the Zod docs.Expected Behaviour:
If invalid value passed as a
defaultValues
field, the default value is set as per.default()
method.Actual Behaviour:
If invalid value passed as a
defaultValues
field, the validation error is thrown.Here's a simple codesandbox: https://codesandbox.io/s/zod-default-values-validation-gkdp9
Does anybody know how to properly do the single source of truth setup with the
.default()
method?Beta Was this translation helpful? Give feedback.
All reactions