I have a problem with observables. I've prepared stackblitz to simplify my problem.
I have 2 observables (obs1$, obs2$) and array of numbers. I want to wait for obs1$ to be completed and then loop through array and return observable of each element, run obs2$.
Here is the function code:
oneByOneObservables(): Observable<unknown> {
const obs1$ = of(1, 2, 3);
const arr = [4, 5, 6];
const obs2$ = of(7, 8, 9);
return obs1$.pipe(
concat(() => arr.map((item) => of(item))),
() => obs2$
);
}
I've got an error :
No overload matches this call. The last overload gave the following error. Argument of type '() => Observable[]' is not assignable to parameter of type 'SchedulerLike | ObservableInput'. Property '[Symbol.iterator]' is missing in type '() => Observable[]' but required in type 'Iterable'.
Thanks for help