I'm trying to use combineLatest
, in particular I need to combine four Observables that emit values of different types with a projection function that returns a boolean type.
From what I get from the Rxjs documentation here, I think that this is the combineLatest
signature I need to use, which is not deprecated:
combineLatest(sources: readonly any[], resultSelector: (...values: A) => R): Observable<R>
with R
being boolean
in my case.
Here is my code snippet where I try to use that function, but Visual Studio Code shows the call with strikeout style and it suggests it's deprecated.
this.canBook$ = combineLatest(
this.userSvc.canRedirect(this.fbSvc.getUserId()),
this.userSvc.canBook(this.fbSvc.getUserId()),
this.calSvc.segnaleOrarioIso8601(),
this.selectedDay$,
(canredir: boolean, canbook: boolean, iso8601: string, selday: ICGiorno) => {
return canredir && (dayjs(selday.iso8601).diff(iso8601, 'hour') > 0) ||
canbook && (dayjs(selday.iso8601).diff(iso8601, 'hour') >= 24);
} );
VS Code says:
The signature '(v1: Observable<boolean>, v2: Observable<boolean>, v3: Observable<string>, v4: Subject<ICGiorno>, resultSelector: (v1: boolean, v2: boolean, v3: string, v4: ICGiorno) => boolean, scheduler?: SchedulerLike): Observable<...>' of 'combineLatest' is deprecated.ts(6387)
However I'm not passing in any scheduler parameter, so I don't understand why VS Code is matching my call with the deprecated signature instead of the one documented above in the Rxjs API doc.
Can you please help me understand why?