mergeAll
mergeAll merges multiple inner observable streams, emitting values from all sources concurrently as they arrive. Unlike merge, which accepts a list of streams directly, this operator works with an observable that emits other observables. Those emitted observables are termed inner streams, while the observable that produces them is called a higher-order observable.
Whenever any of the combined sequences yields a value, that value is forwarded into the output stream. This mechanism is frequently described as flattening in official documentation.
Reach for this operator when the relative order of emissions doesn't matter, and you only care about receiving every value from all merged streams as though they came from a single source.
The operator operates as follows:
- Subscribe to the higher-order source observable.
- Upon each emission of an inner observable, subscribe to that inner observable.
- Forward each value received from any inner source to the downstream observer.
- Only once every inner source has completed, issue the complete notification to the observer.
- If any inner source throws an error, propagate that error notification to the observer immediately.
The diagram below illustrates a higher-order stream labeled H that yields two inner streams, A and B. The mergeAll operator combines the values from these streams and passes each one to the resulting output as it is produced:

Usage
This operator fits scenarios where emission order isn't important; you simply want all values from several combined streams to flow through as if they originated from one stream.
Below is an example demonstrating the use of merge with multiple streams:
const a = interval(500).pipe(map((v) => 'a' + v), take(3));
const b = interval(500).pipe(map((v) => 'b' + v), take(3));
merge(a, b).subscribe((value) => console.log(value));
