I am now puzzled by what causes this error. I am trying to consolidate the result of 7 observations, for example:
var zipped$ = Observable.zip( Observable.of({prop1:1}), Observable.of({prop2:2}), Observable.of({prop3:3}), Observable.of({prop4:4}), Observable.of({prop5:5}), Observable.of({prop6:6}), Observable.of({prop7:7}) );
And then combine them with mergeAll () and reduce () as:
var reduced$ = zipped$.mergeAll().reduce((acc,val) => Object.assign({},acc,val)); reduced$.subscribe(final => console.log(final));
But I get this error: "property 'reduce' does not exist in type '{}'"
To add to the confusion:
If I use 6 values, it works fine.
If observable all returned primitives, it works fine.
if I add this function as the last argument to my zip:
function(...args: any[]) {
It works great.
Is this a bug in RxJS? Am I missing something regarding the zip implementation? Is this an angular compiler? No number of search documents revealed a limitation on the number of arguments for zip. Any insight appreciated.
thanks
EDIT: for anyone else who finds this.
the best job is to simply insert the observables into the array and pass it as one argument, for example:
var zipped$ = Observable.zip(...[ Observable.of({prop1:1}), Observable.of({prop2:2}), Observable.of({prop3:3}), Observable.of({prop4:4}), Observable.of({prop5:5}), Observable.of({prop6:6}), Observable.of({prop7:7})]);
which also works great. EDIT: the array feed has stopped working, now we need to use the spread operator and the array.