In typescript, How to access object key(property) using variable?
for example:
interface Obj {
a: Function;
b: string;
}
let obj: Obj = {
a: function() { return 'aaa'; },
b: 'bbbb'
}
for(let key in obj) {
console.log(obj[key]);
}
but typescript throw below error message:
'TS7017 Element implicitly has an 'any' type because type 'obj' has no index signature'
How to fix it?