未处理的承诺拒绝:无法读取未定义值的 属性 'push'

Unhandled Promise rejection: Cannot read property 'push' of undefined Value

这是我的以下代码:

private convertFormat(src: Array<any>): void {
for (let i of src) {
  this.selectedMonths.push({
    id: i,
    itemName: i
  })
};

this.selectedMonths = JSON.parse(JSON.stringify(this.selectedMonths));
console.log(this.selectedMonths);
}

然而,当我尝试推入已声明的数组 <{}> 时,“.push()”却给我这个错误。

Unhandled Promise rejection: Cannot read property 'push' of undefined ; Zone: ; Task: Promise.then ; Value: TypeError: Cannot read property 'push' of undefined

selectedMonths : any[] = [] 在组件 class 或 ngOnInit this.selectedMonths = [];