Passing a variable that holds an array of schemas into z.discriminatedUnion()
fails
#2819
gahabeen
started this conversation in
Show and tell
Replies: 2 comments 2 replies
-
What are you wanting to be done about this? Or are you just posting it so other people can use your solution? |
Beta Was this translation helpful? Give feedback.
0 replies
-
I'd have expected to work out of the batch. Or am I wrong that it should work? 🤔 |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description
Passing a variable that holds an array of schemas to a
z.discriminatedUnion()
isn't possible onzod@3.22.2
.📍 Run the issue
would prompt
Source provides no match for required element at position 0 in target
error.✅ By-pass it
Manually structuring the first item of the array and spreading the rest for the win 🤟
Beta Was this translation helpful? Give feedback.
All reactions