Object.keys incorrect return type
Connormiha opened this issue · 2 comments
Connormiha commented
TypeScript Version: 3.7.x-dev.201xxxxx
Search Terms:
Code
const a = { a: 'foo' };
Object.keys(a).forEach((key) => {
console.log(a[key]);
});Expected behavior:
No error
Actual behavior:
Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{ a: string; }'.
No index signature with a parameter of type 'string' was found on type '{ a: string; }'.
Related Issues:
dragomirtitian commented
There are good reasons for the current types.
Read here for the explanation : So answer
RyanCavanaugh commented
Search Terms: