kyoumei
kyoumei
Aarktype
Created by kyoumei on 4/15/2025 in #questions
Optional union value?
Hey guys, if I have an object with a key that can either be a number or a string or can be missing. How can I validate it? Thank you
4 replies
Aarktype
Created by kyoumei on 5/11/2024 in #questions
out.summary returns only one error 2.0.0-dev.11
Hi, I am just wondering if I am using this correctly as I followed the new arktype tutorial I made the following schema and validated it However, it only gives me one error For example in the following:
const user = type({
name: 'string>10',
email: 'email'
});

const out = user({
name: 'test',
email: ''
});

if (out instanceof type.errors) {
console.log(out.summary);
} else {
console.log(out);
}
const user = type({
name: 'string>10',
email: 'email'
});

const out = user({
name: 'test',
email: ''
});

if (out instanceof type.errors) {
console.log(out.summary);
} else {
console.log(out);
}
It posts in out.summary, email must be a valid email (was ""), but I was expecting to get both: - name must be more than length 10 (was 4) and; - email must be a valid email (was "") Is this expected behaviour or have I done something incorrectly?
3 replies