类型'string []'的参数不能分配给类型'Many <listiterator <

时间:2019-05-15 12:11:54

标签: angular lodash

=“”

我已经更新了@ types / lodash一个从版本4.14.124到4.14.129的Angular CLI项目,并开始从以前成功转换过的一些现有代码中获取错误。

steps:
  #install
  - name: 'gcr.io/cloud-builders/npm'
    args: ['install']

   #deploy
  - name: 'gcr.io/cloud-builders/gcloud'
    args: ['app', 'deploy']

Argument of type 'string[]' is not assignable to parameter of type 'Many<ListIterator<

有问题的代码是:

Type 'string' is not assignable to type 'ListIterator<

有问题的两行是:

this.activeControllers = _(value)
      .filter(x => x.budgetLevel === this.budgetLevel)
      .groupBy('costCentrePositionId')
      .map((grp, key) => ({
        costCentrePositionId: key,
        positionNumber: grp[0].positionNumber,
        positionTitle: grp[0].positionTitle,
        appliesStartDate: grp[0].costCentrePositionAppliesStartDate,
        appliesEndDate: grp[0].costCentrePositionAppliesEndDate,
        costCentrePositionActive: grp[0].costCentrePositionActive,
        costCentreId: grp[0].costCentreId,
        budgetLevel: grp[0].budgetLevel,
        controllers: _(grp)
          .filter(z => z.assignmentNumber !== null && z.assignmentActive)
          .map(y => (
            {
              assignmentNumber: y.assignmentNumber,
              assignmentRecordStatus: y.assignmentRecordStatus,
              firstName: y.firstName,
              lastName: y.lastName,
              assignmentActive: y.assignmentActive
            })
          )
          .orderBy('assignmentNumber', 'asc')
          .value()
      }))
      .orderBy(['positionNumber', 'appliesStartDate'], ['asc', 'asc'])
      .value();

.orderBy('assignmentNumber', 'asc')

在升级.orderBy(['positionNumber', 'appliesStartDate'], ['asc', 'asc']) 版本之前,orderBy方法成功地接受了一个字符串或字符串数​​组作为参数。

我认为这可能与项目工作区中的TypeScript版本与@types/lodash版本结合在一起吗?

项目使用TypeScript版本3.2.4(由package.json中的语义版本〜3.2.4定义)。

代码按照提供的代码示例使用lodash链。

是否有可能在类型中使用了错误的重载?

任何帮助表示赞赏。

0 个答案:

没有答案