-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
DeclinedThe issue was declined as something which matches the TypeScript visionThe issue was declined as something which matches the TypeScript visionSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
TypeScript Version: 3.7.2
Search Terms:
keys
entries
Code
// Some examples
// obj is a number
let obj: number = 23
for (let key of Object.keys(obj)){
console.log(key)
}
// obj2 is a string
let obj2: string = "hello"
for (let key of Object.keys(obj2)){
console.log(key)
}Note: The same issue occurs with Object.entries
Expected behavior:
TypeScript error since number and string are not valid parameter types for Object.keys(object).
Actual behavior:
No error/warning.
Related Issues:
N/A
aandrejevas
Metadata
Metadata
Assignees
Labels
DeclinedThe issue was declined as something which matches the TypeScript visionThe issue was declined as something which matches the TypeScript visionSuggestionAn idea for TypeScriptAn idea for TypeScript