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

Created on 4 Apr 2019  ·  2Comments  ·  Source: microsoft/TypeScript

Despite the comment https://github.com/Microsoft/TypeScript/pull/12253#issuecomment-263132208
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

Most helpful comment

Duplicate and rejected multiple times: https://github.com/Microsoft/TypeScript/pull/12253#issuecomment-263132208, #30314, #13254. #30228, #28899, #28284, #26901.

More info

All 2 comments

Duplicate and rejected multiple times: https://github.com/Microsoft/TypeScript/pull/12253#issuecomment-263132208, #30314, #13254. #30228, #28899, #28284, #26901.

More info

Thanks @j-oliveras - much appreciated

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wmaurer picture wmaurer  ·  3Comments

blendsdk picture blendsdk  ·  3Comments

fwanicka picture fwanicka  ·  3Comments

dlaberge picture dlaberge  ·  3Comments

kyasbal-1994 picture kyasbal-1994  ·  3Comments