-
Notifications
You must be signed in to change notification settings - Fork 956
Closed
Labels
Description
Package
v4.x
Description
Hi! I was going through the NuxtUI form docs and noticed that in FormExampleBasic.vue, the validate function currently uses the any type.
It might be more accurate to use Partial<Schema> instead, which would provide better type safety and align with the form’s schema typing.
const validate = (state: any): FormError[] => {
const errors = []
if (!state.email) errors.push({ name: 'email', message: 'Required' })
if (!state.password) errors.push({ name: 'password', message: 'Required' })
return errors
}
replace any with Partial<Schema>
const validate = (state: Partial<Schema>): FormError[] => {
const errors = []
if (!state.email) errors.push({ name: 'email', message: 'Required' })
if (!state.password) errors.push({ name: 'password', message: 'Required' })
return errors
}
Link to docs: https://ui.nuxt.com/docs/components/form