Skip to content
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

Change signature of Object.keys to return (keyof T)[] #37495

Closed
iansan5653 opened this issue Mar 20, 2020 · 4 comments
Closed

Change signature of Object.keys to return (keyof T)[] #37495

iansan5653 opened this issue Mar 20, 2020 · 4 comments
Labels
Duplicate An existing issue was already created

Comments

@iansan5653
Copy link

This seems like a simple thing, although I know there's probably a reason it's not already like this.

Currently the signature of Object.keys is:

{
  keys(o: object): string[];
}

But why not make it more specific?:

{
  keys<T extends object>(o: T): (keyof T)[];
}
@MartinJohns
Copy link
Contributor

Please respect the issue templates for bug reports and feature requests.

Both issue templates ask you to search for existing issues before opening a new one.


This is a duplicate and has been rejected multiple times: #12253 (comment), #30314, #13254. #30228, #28899, #28284, #26901, #30749, #31087, #32321, #34498, #35145.

more info

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Mar 20, 2020
@RyanCavanaugh
Copy link
Member

@MartinJohns I'm becoming worried that listing all the duplicates is resulting in an O(n^2) usage of GitHub's storage 😅

@MartinJohns
Copy link
Contributor

Considering how often this and similar questions are asked I have absolutely no doubt that Microsoft / GitHub will run of space in no time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

3 participants