types.union only supports up to 9 arguments for correct typing result #2083
-
and when we stripping out 10th model, it is starting to work normally: The only way I can see to workaround this is to use union of unions, but it sounds like schizophrenia :) Am I missing something? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hey @limbosounds - this sounds like it might be a typescript issue on our end. I'm not sure exactly what's going on there (hopefully someone else does). I'm sorry I don't have a better answer for you, but I'd be happy to move this to the issue tracker if you like! We are slowly working through a lot of the existing issues, including our overall TypeScript challenges, so hopefully we can figure this out for you in the coming months. |
Beta Was this translation helpful? Give feedback.
Hello and thank you for your response!
This issue has a workaround:
This workaround supports up to 81 types in total and resulting type is just the same as if it was a plain union.
So, it's kinda suitable for me despite looking schizophrenic 🤣
I tried to discover the source of this issue, and seems like it is in
types.union
definitionIt has 33 overloads, and each next has more generic types than previous
Simplified example