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
fixed types for Object.values and Object.entries #58358
base: main
Are you sure you want to change the base?
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