A
arktype2mo ago
Hylmew

Specifying a field name

Hello! I have the following schema:
const schema = type({
pollInterval: type.number.atLeast(500),
})

const result = schema({ pollInterval: 50 })

if (result instanceof type.errors) {
console.log(result.summary)
}
const schema = type({
pollInterval: type.number.atLeast(500),
})

const result = schema({ pollInterval: 50 })

if (result instanceof type.errors) {
console.log(result.summary)
}
The summary outputs: pollInterval must be at least 500 (was 50). Is there any way to change pollInterval to something else (eg. Poll interval)? I can't find anything regarding this on the docs.
1 Reply
ssalbdivad
ssalbdivad2mo ago
It sounds like this is what you're looking for: https://github.com/arktypeio/arktype/issues/1431 Would love to get this implemented, will shoot for a followup to 2.2- would also be happy to accept external contributions on it if you're interested! In the meantime the best workaround would be to just configure message
GitHub
Error-specific property aliases · Issue #1431 · arktypeio/arktype
From Discord user @_stuartb: Is there a way to set an alias for a property name, which will be shown before the "must be" in errors? E.g. if I have a property 'dob' that holds a d...

Did you find this page helpful?