fixed types for Object.values and Object.entries#58358
fixed types for Object.values and Object.entries#58358typeholes wants to merge 3 commits intomicrosoft:mainfrom
Conversation
|
@typescript-bot test it |
|
Hey @jakebailey, the results of running the DT tests are ready. Everything looks the same! |
|
@jakebailey Here are the results of running the user tests comparing Everything looks good! |
|
@jakebailey Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@jakebailey Here are the results of running the top 400 repos comparing Everything looks good! |
|
Once #58372 🙂 lands the overload should probably be replaced by a simple union. |
|
fixes #58376 |
|
Does this also need some sort of handling for objects with |
There is already an overload for |
|
Thanks, I didn't look beyond the context of the diff :) Locally I use something like this: type KeyToString<K extends number | string | symbol> = K extends string ? K : K extends number ? `${K}` : never;
keys<K extends number | string | symbol, V>(o: Record<K, V>): KeyToString<K>[];
entries<K extends number | string | symbol, V>(o: Record<K, V>): [KeyToString<K>, V][];
values<K extends number | string | symbol, V>(o: Record<K, V>): V[];but aside from being too complex for the standard library, that probably opens up a whole can of worms if applied to everything (works well for my code though!). |
Fixes #26010