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

stricter definition of Object.keys; why not? #45390

Closed
abetaev opened this issue Aug 10, 2021 · 2 comments
Closed

stricter definition of Object.keys; why not? #45390

abetaev opened this issue Aug 10, 2021 · 2 comments

Comments

@abetaev
Copy link

abetaev commented Aug 10, 2021

why instead

keys(o: object): string[];

not to have

keys<T = Record<string, unknown>>(o: T): (keyof T)[];

?
are there any issues with that?

@jcalz
Copy link
Contributor

jcalz commented Aug 10, 2021

If by "issues" you mean "GitHub issues", yes there are plenty: #13254, #26901, #28284, #28899, #30228, #30314, #30749, #31087, #32321, #34498, #35145, #37495, #44706, etc. 😜

See https://stackoverflow.com/questions/55012174/why-doesnt-object-keys-return-a-keyof-type-in-typescript

@abetaev
Copy link
Author

abetaev commented Aug 10, 2021

my bad, didn't look through closed ones.
thanks for the explanation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants