Угловая 6, вилка rxjs 6Присоединиться к карте - PullRequest
0 голосов
/ 15 октября 2018

Этот кодовый код работал как положено в Angular 4:

Observable.forkJoin(
  Observable.of('test1'),
  Observable.of('test2')
).map(result => {
  console.log(result);
}).subscribe();

Этот фрагмент кода больше не работает с rxjs 6:

forkJoin(
  of('test1'),
  of('test2')
).pipe(map(result => {
  console.log(result);
})).subscribe();

Я получаю следующую ошибку компиляции:

ERROR in app/services/bundles/karaf-bundles.service.ts(47,12): error TS2345: Argument of type 'OperatorFunction<[string, string], void>' is not assignable to parameter of type 'OperatorFunction<any, any>'.
  Types of parameters 'source' and 'source' are incompatible.
    Type 'Observable<any>' is not assignable to type 'Observable<[string, string]>'.
      Types of property 'source' are incompatible.
        Type 'import("/Users/moritzvieli/node_modules/rxjs/internal/Observable").Observable<any>' is not assignable to type 'import("/Users/moritzvieli/repo/cltmgmtconsole/web/node_modules/rxjs/internal/Observable").Observ...'.
          Types of property 'source' are incompatible.
            Type 'import("/Users/moritzvieli/node_modules/rxjs/internal/Observable").Observable<any>' is not assignable to type 'import("/Users/moritzvieli/repo/cltmgmtconsole/web/node_modules/rxjs/internal/Observable").Observ...'.

Как мне сопоставить форкджоин в Angular 6?

1 Ответ

0 голосов
/ 15 октября 2018

Сам понял: я импортировал неправильный forkJoin из "rxjs / observable / forkJoin" вместо "rxjs".

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...