错误消息“类型 '{'itemType': string;'qty': string;'time': string;}' 的参数不可分配给'openInventory []'类型的参数。类型'中缺少属性'length' { ‘itemType’:字符串;‘数量’:字符串;‘时间’:字符串;}’。”
片段
openInventorys: AngularFireList<openInventory[]>;
openInventory: AngularFireObject<any>;
addOpenInventory(org: any, type:string, qty:string) {
this.openInventorys = this.af.list('/inventory/' + org+ '/openInventory') ;
var openInventoryData = { 'itemType': type, 'qty': qty, 'time': moment().format('YYYY-MM-DD HH:mm') };
this.openInventorys.push(openInventoryData);
}
interface openInventory {
$key?: string;
itemType?: string;
qty?: string;
time?: string;
}