Skip to content

How to avoid type error on validationSchema when using yup with useForm<T>? #3824

Answered by logaretm
TechWatching asked this question in Q&A
Discussion options

You must be logged in to vote

This has been a problem for a while because it seems like required doesn't make the type non-nullable. In 4.6 this will be fixed since we drop inferring the types from yup schema. Sadly we will use some autocompletion and type features but most people cast it to any to avoid the errors they keep getting.

Yup 1.0 might resolve this but I haven't checked their progress yet or the type of changes they will introduce. Either way vee-validate shouldn't depend on yup types because it forces people to install it into their projects to avoid typescript issues.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@TechWatching
Comment options

Answer selected by TechWatching
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants