getMaterialList() {
const data = this.myhttp.getHTTP('/getMaterialList').toPromise();
return data;
}
async getCalculateInventory(Offer, details) {
....
details['Inventory'] = []
if (this.isEmpty(this.AllMaterial)) {
this.AllMaterial = await this.getMaterialList();
}
for (let y in this.AllMaterial) {
if (this.AllMaterial[y].type == 'inventory') {
var some: any = {};
....
details.Inventory.push(some);
....
}
}
...
return details;
}
getCalculateInventoryToWindow(Offer, details) {
var InventoryCalculate = this.getCalculateInventory(Offer, details);
...
InventoryCalculate['WindowInventory'] = [];
...
for (let y in this.AllMaterial) {
if (this.AllMaterial[y].type == 'window') {
var some: any = {}
.....
InventoryCalculate.WindowInventory.push(some);
ItogMonth = ItogMonth + some.ItogAmortization;
ItogToStart = ItogToStart + some.Itog;
}
}
InventoryCalculate.material= InventoryCalculate.material + ItogMonth;
InventoryCalculate.materialToStart = InventoryCalculate.materialToStart + ItogToStart;
return InventoryCalculate;
}
Property 'WindowInventory' does not exist on type 'Promise<any>'.
Property 'material' does not exist on type 'Promise<any>'.
Property 'material' does not exist on type 'Promise<any>'.
Property 'materialToStart' does not exist on type 'Promise<any>'.
Property 'materialToStart' does not exist on type 'Promise<any>'.
Я понимаю что ошибка происходит из за асинхронных функций, но как избежать ошибок?