Vee validate zod schema defaultValue

Author: shammahrCreated Oct 17, 2025Updated Jan 22, 2026

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

  1. Create the Zod schema above.
  2. Wrap it with toTypedSchema.
  3. Initialize useForm with it.
  4. 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

bash
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