3

我有以下代码在 rxjs 5 中编译时没有错误:

a$ = Observable.combineLatest([x$, y$])
  .subscribe(([x, y]:[X, Y]) => {

当我更新到 rxjs 6 时,会发生以下错误:

Argument of type '([x, y]: [X, Y]) => void' is not assignable to parameter of type '(value: Y[]) => void'.
  Types of parameters '__0' and 'value' are incompatible.
Type 'Y[]' is not assignable to type '[X, Y]'.
  Property '0' is missing in type 'Y[]'.

此外,如果我将 X 或 Y 类型更改为 any 类型,错误就会消失。

4

0 回答 0