logaretm / vee-validate

✅ Painless Vue forms
https://vee-validate.logaretm.com/v4
MIT License
10.79k stars 1.26k forks source link

Using zod's preprocess results in defineField returning Ref<unknown> #4644

Closed KieranSunshine closed 8 months ago

KieranSunshine commented 9 months ago

What happened?

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

  1. Create a zod schema that utilizes z.preprocess.
  2. Access the field which uses z.preprocess through defineField
  3. Check the typing of the value returned by defineField, it will be Ref<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

logaretm commented 8 months ago

AFAIK this is intended as preprocessors always take in an unknown value. This is discussed here.