-
Notifications
You must be signed in to change notification settings - Fork 220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Discriminated unions (fast lookup) #1183
Comments
I made something up over in #897 (comment) for this but I've never got around to polishing it up to be merged |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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?
The text was updated successfully, but these errors were encountered: