Using RXJS I have the following
merge(this.optionValueChanged$, this.options.changes).subscribe(() => {
this.selectionByValue(this.pValue)
}),
now, on hover this return
@deprecated — use {@link scheduled} and {@link mergeAll} (e.g. `scheduled([ob1, ob2, ob3], scheduled).pipe(mergeAll())
but I read about scheduled, and it looks like it's not exactly doing what I want. Also, I can't figure out what those the scheduled
inside the method scheduled
stand for.
Typescript selects the wrong overload. Only the overloads that accept SchedulerLike
are deprecated.
Try to change the order of your parameters
merge(this.options.changes, this.optionValueChanged$)
Or wrap them in an array and spread
merge(...[this.optionValueChanged$, this.options.changes])
Also ran into this, was solved when I explicitly defined the parameter types before passing into merge
.
i.e.
const obs1: ObservableInput<any> = ...
const obs2: ObservableInput<any> = ...
return merge(obs1, obs2).pipe(...)
I agree, that is confusing. I always saw it as some kind of any
in that way, that this is a placeholder for an observable which emits other observables.
Have a look on this example
const ob1 = of(1).pipe(delay(5000));
const ob2 = of(2).pipe(delay(1000));
const ob3 = of(3).pipe(delay(2000));
function schedule() {
return of(ob1, ob2, ob3);
}
schedule().pipe(
mergeAll(),
).subscribe(console.log);
It has the same functionality as merge, the 1 is printed last, because it is emitted last.
See stackblitz: https://stackblitz.com/edit/rxjs-z6t8yn?file=index.ts
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With