【发布时间】:2019-10-21 18:36:00
【问题描述】:
界面是这样的
export interface Patient {
doctors: [{
id: null,
gp: null,
}]
}
这是我的元组
linkedDoctorShort: Array<any> = []; // will contain only the ID and GP
我尝试了一些在 StackOverflow 上找到的解决方案,但仍然遇到同样的错误,尤其是当我想保存所有信息时:
onSave() {
const patientInfo: Patient = {
doctors: this.linkedDoctorShort,
};
错误信息:
类型“any[]”中缺少属性“0”,但类型“[{ id: string; gp:布尔值; }]'。
感谢您的帮助
【问题讨论】:
标签: javascript typescript