我对angular7中的lodash value()函数有些麻烦。 我的代码
export interface TariffList {
AccToNastrId: number,
TariffName: string,
List: MeterTariffsVm[]
}
...
meterTariffs: TariffList[];
...
this.pobutService.getMeterTariffs(this.cabinetId).subscribe(
(data: MeterTariffsVm[]) => {
this.isLoading = false;
this.meterTariffs = _(data).groupBy('AccToNastrId')
.map((objs: MeterTariffsVm[], accToNastrId: number) => ({
AccToNastrId: accToNastrId,
TariffName: _.find(objs, ['AccToNastrId', +accToNastrId]).TariffName,
List: objs
})).value();
},
error => {
this.notificationService.errorAlert(error);
this.isLoading = false;
});
我在这里有错误:
this.meterTariffs = _(data).groupBy('AccToNastrId')
.map((objs: MeterTariffsVm[], accToNastrId: number) => ({
AccToNastrId: accToNastrId,
TariffName: _.find(objs, ['AccToNastrId', +accToNastrId]).TariffName,
List: objs
})).value();
下一个错误: (TS)类型'boolean []'无法分配给类型'TariffList []'。 有什么想法吗?