felte
felte copied to clipboard
`$errors` store type signature is incorrect with yup validator
Describe the bug
When an array does not contain .required() the type signature of the $errors store becomes incorrect.
const schema = yup.object({
calculations: yup.array(yup.object({
label: yup.string().required(),
})),
});
This is my schema. When I attempt to access $errors.calculations.[index].label typescript gives me a type error–Property 'label' does not exist on type 'string'. When I add .required() to the root of calculations the type signature is considered to be correct
const schema = yup.object({
calculations: yup.array(yup.object({
label: yup.string().required(),
})).required(),
});
Same error applies when using notRequired()
Which package/s are you using?
felte (Svelte), @felte/validator-yup
Environment
- OS: macOS 12.3
- Browser: Chrome 102.0.5005.115
- Version: 1.2.2
To reproduce
No response
Small reproduction example
No response
Screenshots



Additional context
No response