-
-
Notifications
You must be signed in to change notification settings - Fork 229
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
Allow for a AllUnionKeys #192
Comments
Hey @filipomar, thanks for your proposal and nicely filled feature request :) I imagine it like this:
tests:
thank you :) |
Alright, PR open at #193 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a real problem or use-case?
I have in my project a situation I simplified to:
Where I want all the keys from my union, so
'x' | 'y' | 'z'
Now, currently that gives me a
never
, as the keys never match.Describe a solution including usage in code example
In order to get those keys, I thought of trying to turn this Union into a Intersection by using:
But that also doesn't work, giving me
string | number | symbol
, as the intersection is also never.But if I give them a common base type, across all of them, then it works, which came out as:
I tried to think about an alternative that feels less hacky, but came up short.
Who does this impact? Who is this for?
The impact is limited to anyone that opts to use it, and its for anyone that wants all the possible keys in an union.
I am willing to open a PR for this, but wanted first to see if the concept would be accepted.
The text was updated successfully, but these errors were encountered: