Skip to content Skip to sidebar Skip to footer

Multicast Operator With Pipe In Rxjs 5.5+

How do I use the multicast() operator with the new recommended approach in RxJS 5.5 of using pipe() instead of chaining operators? I get a TypeScript error when I try to use connec

Solution 1:

The current - v5.5.10 and v6.1.0 - typings for pipe are not aware of the Observable subclasses, so I use a type assertion, like this:

const connectedObs = interval(500).pipe(
    filter(count => count % 2 === 0),
    take(5),
    multicast(even$)
) as ConnectableObservable<number>;
const connectedSub = connectedObs.connect();

Post a Comment for "Multicast Operator With Pipe In Rxjs 5.5+"