We are using the old version of combineLatest
and
TSLint
strikes out combineLatest
with this message:
@deprecated — resultSelector no longer supported, pipe to map instead
Approach
The old way is to pass the result selector like this:
let o$: Observable<boolean> = combineLatest(
[of(true), of(false)],
(value1, value2) => {
return !!(value1 && value2);
}
);
The new way is to pipe through the result selector with map:
o$ = combineLatest([of(true), of(false)]).pipe(
map(arr => {
console.log(`a[0] is ${arr[0]} && a[1] is ${arr[1]}`);
return !!(arr[0] && arr[1]);
})
);
o$.subscribe(o => console.log(`ohh o is ${o}`));
We now see that o$
emits false
, since the second value passed in the to map
via arr
is false
.