We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Versions
Describe the bug The following form
<template> <div> <div> <Field name="email" as="input" type="email" /> <div>{{ errors.email }}</div> </div> <div> <Field name="name" as="input" /> <div>{{ errors.name }}</div> </div> <div> <Field name="password" as="input" type="password" /> <div>{{ errors.password }}</div> </div> <pre>Is form dirty: {{ isDirty }}</pre> <!-- print form values --> <pre>{{ values }}</pre> </div> </template> <script lang="ts"> import { defineComponent, computed } from 'vue'; import { Field, useForm } from "vee-validate"; import * as yup from "yup"; export default defineComponent({ components: { Field, }, setup() { const schema = yup.object().shape({ email: yup.string().required().email(), name: yup.string().required(), password: yup.string().required().min(8), }); const { meta, values, errors } = useForm({ validationSchema: schema, }); const isDirty = computed(() => meta.value.dirty); return { errors, values, isDirty, }; }, }); </script>
produces a TypeScript error:
ERROR in src/App.vue:39:7 TS2322: Type 'ObjectSchema<Shape<object | undefined, { email: string; name: string; password: string; }>, object>' is not assignable to type 'Record<string, string | Record<string, any> | GenericValidateFunction>'. Index signature is missing in type 'ObjectSchema<Shape<object | undefined, { email: string; name: string; password: string; }>, object>'. 37 | }); 38 | const { meta, values, errors } = useForm({ > 39 | validationSchema: schema, | ^^^^^^^^^^^^^^^^ 40 | }); 41 | 42 | const isDirty = computed(() => meta.value.dirty);
To reproduce Steps to reproduce the behavior:
Run this project (npm install then npm run serve): vee-validate-v4.zip
npm install
npm run serve
TypeScript error pops up.
Expected behavior There should be no TypeScript error.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered:
fix: provide yup object schema type to the useForm closes #2988
29157f7
Thank you for reporting this, I missed adding the ObjectSchema type, tagged in beta.11
ObjectSchema
beta.11
Sorry, something went wrong.
No branches or pull requests
Versions
Describe the bug
The following form
produces a TypeScript error:
To reproduce
Steps to reproduce the behavior:
Run this project (
npm install
thennpm run serve
):vee-validate-v4.zip
TypeScript error pops up.
Expected behavior
There should be no TypeScript error.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: