Is there a better way to do '.or' ?

We have some complicated union types. I am finding that doing '.or' off a arktype is going to cause a ugly nesting. I am hoping there is a better way to use 'or', pehaps there is some util i dont know about? See screenshots of chained or vs the idea or an or util.
No description
No description
2 Replies
TizzySaurus
TizzySaurus2w ago
There's tuple syntax, which you might prefer:
const preType = type(...);

const t = type([
preType.and({foo: "'event'"}),
"|",
preType.and({foo: "'vendor'"})
]);
const preType = type(...);

const t = type([
preType.and({foo: "'event'"}),
"|",
preType.and({foo: "'vendor'"})
]);
GreggOD
GreggODOP2w ago
Nice, thank you, it works

Did you find this page helpful?