-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Description
What happened?
zod: 4.1.11
@vee-validate/zod: 4.15.1
vee-validate: 4.15.1
Expected behavior
Zod’s default function should be preserved and not shadowed by a string value when used through toTypedSchema.
value._def contains both a defaultValue getter and a plain string property of the same name, which shadows the getter. This makes value._def.defaultValue() fail inside @vee-validate/zod.
Reproduction steps
- Create the Zod schema above.
- Wrap it with toTypedSchema.
- Initialize useForm with it.
- Observe the runtime error during schema casting.
Version
Vue.js 3.x and vee-validate 4.x
What browsers are you seeing the problem on?
- Firefox
- Chrome
- Safari
- Microsoft Edge
Relevant log output
vee-validate-zod.mjs:158 Uncaught (in promise) TypeError: value._def.defaultValue is not a function
at vee-validate-zod.mjs:158:37
at Array.map (<anonymous>)
at getDefaults (vee-validate-zod.mjs:156:60)
at Object.cast (vee-validate-zod.mjs:94:34)
at resolveInitialValues (vee-validate.mjs:2170:29)
at useForm (vee-validate.mjs:2189:33)
at setup (xxxx.vue:24:14)
at callWithErrorHandling (runtime-core.esm-bundler.js:199:19)
at setupStatefulComponent (runtime-core.esm-bundler.js:7996:25)
at setupComponent (runtime-core.esm-bundler.js:7957:36)Demo link
https://codesandbox.io/p/devbox/qm2pv6
Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
No labels