Morph on failure
I have a type
and objects of type
{ id: string>0, label?: string>=0 }
and want to create a type that will try to morph with (o: { id: string>0, label?: string>=0 }) => { o.label ||= o.id }
only on failure, and then try to revalidate with the same validator
What's the best way to do that?2 Replies
I guess I need an ordered union for this
My current solution
Ordered unions are a thing but not something I've exposed yet in the primary API
I'm going to use them for
match
expressions though since that's essentially what pattern matching is