Tom
Aarktype
•Created by Tom on 1/20/2025 in #questions
How to ensure optimal discrimination of union types?
I have a union of types, each of which has an attribute with literal values that can in theory be used to quickly identify an appropriate top-level type. They all look like this:
Is there some way I can setup my types or configure arktype such that it does a breadth-first discrimination of types within a union? does it store the result of the matching type somewhere? and finally - I'd like to understand this logic a bit more, but I am completely unfamiliar with the code base, if someone could point me at the code for resolving type unions that would be very useful. Thanks!
2 replies
Aarktype
•Created by Tom on 1/7/2025 in #questions
Can arktype drop data not covered by schema?
I want to regurgitate my input according to the schema model, e.g:
I'd want to make
out
contain only {name: "bob"}
. Is there a way to do this with arktype?8 replies