Separate the error messages for a specific form input from .summary

Hi I'm new to ArkType and I'm having a challenge with the error messaging. if I use dot summary i see all of the error messages but i'm not sure how to separate the error messages for a specific input. Any help will be most welcome.
1 Reply
ssalbdivad
ssalbdivad2w ago
Hey and welcome! The top-level ArkErrors object that is returned is an array of the individual errors along with some individual convenience properties. Depending on your needs, you could either iterate over those errors and inspect the path and message of each, or use the top-level errors.byPath to get the error for each path
const invalid = T({ foo: 5 })

if (invalid instanceof type.errors) {
console.log(invalid.byPath)
}
const invalid = T({ foo: 5 })

if (invalid instanceof type.errors) {
console.log(invalid.byPath)
}

Did you find this page helpful?