Closed
Description
What happened?
The path syntax that works with form errors generated by validation schemas is rejected by form.setFieldValue
typechecking. This only affects TS usage because if I silence the TS error form.setFieldValue
works as expected using both syntaxes.
steps[0].name
works for gettingerrorMessage
from field but is not accepted byform.setFieldValue
steps.0.name
doesn't work for gettingerrorMessage
from field, but is accepted byform.setFieldValue
Can the Path
type be updated so that it produces paths like this:
type Step = {
name: string
}
type Form = {
steps: Step[]
}
type Result = Path<Form> // `steps` | `steps[${number}]` | `steps[${number}].name`
// ^ ^ ^ ^
// instead of
type Result = Path<Form> // `steps` | `steps.${number}` | `steps.${number}.name`
// ^ ^
Reproduction steps
- Visit https://stackblitz.com/edit/vee-validate-v4-cross-field-validation-rfx97g?file=src%2Fmain.ts
- See the TS error at line 39 of main.ts
- See the error message displayed only for
steps[0].name
in rendered app side
Version
Vue.js 3.x and vee-validate 4.x
What browsers are you seeing the problem on?
- Firefox
- Chrome
- Safari
- Microsoft Edge
Relevant log output
No response
Demo link
Code of Conduct
- I agree to follow this project's Code of Conduct