Add additional type overload to Object.values #30870
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
master
branchgulp runtests
locallyI'm making this PR on github, gonna check out the project and run gulp/tests as soon as I open it
Motivation
I use a lot of enums, and I am very frequently writing code which exhuastively switches over enums, and so on. Fairly often I find that I want to check whether a value is contained within an enum, or iterate over the values in the enum.
The way I've been doing that is like this:
with this new overload, I can more simply do
As far as I can tell, this new overload doesn't interfere with standard uses of
Object.values
Tests
still working on it. opening as draft for now