microsoft/TypeScript

Object.keys must use keyof of generic type <T extends object>, not just <T>

Boeny opened this issue · 2 comments

Boeny commented

Despite the comment #12253 (comment)
I would proceed the discussion with just a little suggestion:

the Object.keys function should look like:
keys<T extends {}>(o: T): Array<keyof T>;

Duplicate and rejected multiple times: #12253 (comment), #30314, #13254. #30228, #28899, #28284, #26901.

More info

Thanks @j-oliveras - much appreciated