当我尝试循环状态数据时出现以下错误
类型 '{ [key: number]: any[]; 上不存在属性 'length' }'。
国家声明
export interface State {
resultData:{ [key: number]: any[] };
}
类声明
export class AccountComp extends React.PureComponent<Props, State> {
constructor(props: Props) {
super(props);
this.state = {
resultData: {},
};
}
update function showing issue in second for loop .
Property 'length' does not exist on type '{ [key: number]: any[]; }'.
update = () => {
for (let i = 0; i < 7; i++)
{
for (let j = 0; j < this.state.resultData.length; j++) // showing issue in this line
{
}
}
}
慕斯709654
相关分类