Motivation:
I have a union of around 50 types, from which some are very complex. In this scenario input assertion takes significant time to be evaluated. As I understand superstruct union - it iterates over all union members until there's match. All of these types have a common field "type" which could be used for faster lookup.
Motivation: I have a union of around 50 types, from which some are very complex. In this scenario input assertion takes significant time to be evaluated. As I understand superstruct union - it iterates over all union members until there's match. All of these types have a common field "type" which could be used for faster lookup.
Idea: When checking around I noticed "zod" has something exactly like this https://github.com/colinhacks/zod#discriminated-unions
Is this a feature you'd welcome in superstruct?