[英]Typescript Object is of type unknown
You need to implement type for value.您需要为值实现类型。 Try smth like this:
像这样尝试:
type valueType = {
id: string,
field1: number,
field2: string,
}
const obj = {
a: {
id: '12',
field1: 1,
field2: 'asdas',
}
}
for (const [key, value] of Object.entries(obj)) {
const typedValue: valueType = value;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.