我正在嘗試將數組復制到對象中的數組中。我收到這個錯誤Type 'any[]' is not assignable to type '[]'.
Target allows only 0 element(s) but source may have more.我的對象是newForm: {formName: string, formId: string, formAttributes:[], formResponses:[]};我正在復制這個數組-formAttributeValues=["firstname", "lastname"]如下:this.newForm.formAttributes= [...this.formAttributeValues];這是行不通的。我該如何解決這個問題?
如何給對象中的數組賦值
陪伴而非守候
2023-07-06 15:11:43