When using zod's preprocess in a schema, the type returned by defineField is Ref<unknown> rather than the type defined in the preprocess. It is however correctly typed in the handleSubmit handler.
Reproduction steps
Create a zod schema that utilizes z.preprocess.
Access the field which uses z.preprocess through defineField
Check the typing of the value returned by defineField, it will be Ref<unknown>.
What happened?
When using zod's preprocess in a schema, the type returned by
defineField
isRef<unknown>
rather than the type defined in the preprocess. It is however correctly typed in thehandleSubmit
handler.Reproduction steps
z.preprocess
.z.preprocess
throughdefineField
defineField
, it will beRef<unknown>
.Version
Vue.js 3.x and vee-validate 4.x
What browsers are you seeing the problem on?
Relevant log output
No response
Demo link
https://github.com/KieranSunshine/vee-validate-preprocess-resolves-to-unknown/blob/b2bcd949323153e1ff72e6c5cee187f7b139466b/src/App.vue
Code of Conduct