RxJS 6.5.5 Start已弃用。可供替代的
将Angular更新至第9版,并在RxJS 6.5.5 Start已弃用。可供替代的,rxjs,rxjs6,Rxjs,Rxjs6,将Angular更新至第9版,并在startWith函数保持不推荐状态时发生。链接到AsyncScheduler类的文档,但在我的简单示例中如何使用它,我不知道: private subscribeFilters(): void { this.filters.valueChanges .pipe( startWith(this.filters.value), pairwise(), ) .subscribe(([prev, next]: [an
startWith
函数保持不推荐状态时发生。链接到AsyncScheduler
类的文档,但在我的简单示例中如何使用它,我不知道:
private subscribeFilters(): void {
this.filters.valueChanges
.pipe(
startWith(this.filters.value),
pairwise(),
)
.subscribe(([prev, next]: [any, any]) => {
if (JSON.stringify(prev) !== JSON.stringify(next)) {
this.loadPage();
}
});
}
如您所见,我正在使用startWith
设置过滤器初始状态,并在第一次页面加载时排除冗余请求
如何实现相同的逻辑而不使用
startWith
。可能正如文档中所述,使用AsyncScheduler
或其他方式?我认为this.filters
或this.filters.value
是any
,这会导致问题,因为any
与SchedulerLike
匹配
请尝试正确地键入它们,这样它就不会再被检测为类似于
SchedulerLike
,通知也应该消失。这是否回答了您的问题?正确键入它们是什么意思?当我使用startWith
时,弃用已经消失了,但有点像黑客。我的意思是公共过滤器:{value:string}
,类似的东西。但是,如果通用有效并删除了通知,它也是可以接受的。主要目的是让TS或Lint知道它不是类似于SchedulerLikesignature的签名。我理解。非常感谢。