我使用TypeScript 2.4,sbt和下划线。 当我使用时。
this.userData.summaryMonth = _.reduce(this.userData.monthValues, (m, n) => m+n, 0);
我的界面
export interface IUserPlan {
id: number,
login: string,
fullName: string,
role: IUserPlanRole,
month?: string[]
monthValues?: number[],
summaryDay?: 0,
summaryMonth?: number,
workingDays?: number,
nonWorkingDays?: number,
filterType: string
}
我收到错误:
[info] TypeScript compiling on 1 source(s)
[error] /developer/projects/------/app/assets/admin/statistics/statistics.controller.ts:220: Operator '+' cannot be applied to types 'number' and '{}'.
[error] this.userData.summaryMonth = _.reduce(this.userData.monthValues, (m, n) => m+n, 0);
^
[error] one error found
[error] (bo/web-assets:typescript) com.typesafe.sbt.web.CompileProblemsException