Here's a snippet of my code:
const observable:Observable<number> = Observable.from([1, 2, 3])
.reduce((sum: number, number: number) => {
return sum + number
}, 0)
observable.subscribeOnNext((sum) => console.log(sum))
Everything seems to be working fine, but I'm encountering an error from the Typescript compiler:
error TS2339: Property 'reduce' does not exist on type 'Observable'.
If I switch out reduce
for scan
, the error disappears (= the compiler recognizes the definition of scan
, but not reduce
).
My environment includes npm, typescript (version 2.0.10), rxjs (version 4.1.0), and @types/rx (version 2.5.34).