Lodash value()函数:类型boolean []是不可分配的

时间:2019-04-03 09:20:54

标签: angular typescript lodash

我对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 []'。 有什么想法吗?

0 个答案:

没有答案