【发布时间】:2020-05-09 09:22:52
【问题描述】:
我正在学习打字稿,我正在尝试定义一个函数来遍历对象的值,但是当我这样做时,tslint 告诉我:
Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'. No index signature with a parameter of type 'string' was found on type '{}'.ts(7053)
这是我的代码:
function proxyData(data: object) {
Object.keys(data).forEach((key: string) => {
console.log(data[key]);
});
}
【问题讨论】:
标签: typescript tslint