Inferred types with zod validator
Hello 🙂
Say I have a zod schema that I validate against the form, that is all working well
But what if I don't want to list out all the defaultValues, where it infers types from normally
if I export FormValues type using zod infer of the schema, and bring it into the form, where do I put this? When I put it on useForm<FormValues> TS freaked out
Thanks a million
3 Replies
mere-teal•11mo ago
Hey, can you try like this?
xenial-blackOP•11mo ago
D'oh, thank you very much @ksgn
mere-teal•11mo ago
The Example has just been updated as well - the recommended way is to use a type assertion on the defaultValues-Obj.
https://github.com/TanStack/form/pull/982
GitHub
docs: update react-zod form example defining a zod schema by vicent...
Based on the discussion on #978 with @Balastrong
This PR updates the docs example on react/zod using the most common case which is defining a Zod schema at the top level, and then using it on the u...