不推荐使用Angular 6 ng棉绒 [英] Angular 6 ng lint combineLatest is deprecated

查看:73
本文介绍了不推荐使用Angular 6 ng棉绒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近从Angular 5更新到了Angular6.

I recently updated from Angular 5 to Angular 6.

我收到此警告combineLatest is deprecated: resultSelector no longer supported, pipe to map instead. Rxjs是6.1.0版本,tslint是5.10.0,Angular CLI是6.0.0和Typescript 2.7.2.我正在这样使用它:

I'm getting this warning combineLatest is deprecated: resultSelector no longer supported, pipe to map instead. Rxjs is version 6.1.0, tslint is 5.10.0, Angular CLI is 6.0.0 and Typescript 2.7.2. I'm using it like this:

const a$ = combineLatest(
  this.aStore.select(b.getAuth),
  this.cStore.select(b.getUrl),
  (auth, url) => ({auth, url}),
);

我也尝试过这样:

empty().pipe(
combineLatest(...),
  ...
)

但这给了我:combineLatest is deprecated: Deprecated in favor of static combineLatest并且不推荐使用empty,而推荐使用其静态版本.

But this gives me: combineLatest is deprecated: Deprecated in favor of static combineLatest and empty is also deprecated in favor of its static version.

推荐答案

combineLatest已弃用:resultSelector不再受支持,管道 代替地图

combineLatest is deprecated: resultSelector no longer supported, pipe to map instead

以上警告建议删除resultSelector作为您在CombineLatest中可观察到的最后一个函数,并将其作为map运算符的一部分提供,如下所示:

The above warning is recommending to remove the resultSelector the last function you provided in combineLatest observable and provide it as part of map operator as follows

const a$ = combineLatest(
  this.aStore.select(b.getAuth),
  this.cStore.select(b.getUrl)
);

const result$ = a$.pipe(
  map(results => ({auth: results[0], url: results[1]}))
)

这篇关于不推荐使用Angular 6 ng棉绒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆