You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Although the code is working I get the following TS-error:
Element implicitly has an 'any' type because expression of type 'phoneNumbers[${number}].phone' can't be used to index type 'Partial<Record<"phoneNumbers" | phoneNumbers.${number} | phoneNumbers.${number}.phone | ....
But when I console.log the errors-object I get:
{
phonenumbers[1].phone: 'at least 4 digits'
}
When I write the code according to type definitions it doesn't work.
Reproduction steps
set up a form with an array-field and useFiledArray
set up some validation on the fieldarray
try accessing the specific errors for the fields contained in the fieldarray (like above)
Our types does not support array indices at the moment which was a short sight on my part, the types were added later than the syntax implementation. Sadly only workaround is to cast your keys/paths.
This would be a breaking change, but the fix we are going for is to remove array indices support and only use dot paths.
Hi @logaretm ,
Thanks for answering and thank you for an otherwise very good package by the way.
Changing the error objects structure to match the type would of course break things. But what about changing the type to reflect the real world object? Would that be worth considering?
What happened?
This is my first Github issue, so please bear with me...
The keys in the Error object don't match their TS definition. Lets say I have the Following:
and in the markup:
Although the code is working I get the following TS-error:
Element implicitly has an 'any' type because expression of type '
phoneNumbers[${number}].phone
' can't be used to index type 'Partial<Record<"phoneNumbers" |phoneNumbers.${number}
|phoneNumbers.${number}.phone
| ....But when I console.log the errors-object I get:
When I write the code according to type definitions it doesn't work.
Reproduction steps
Version
Vue.js 3.x and vee-validate 4.x
What browsers are you seeing the problem on?
Relevant log output
No response
Demo link
ihavenoideahowtosetupcodepenwithvueandTS.sorry
Code of Conduct
The text was updated successfully, but these errors were encountered: