I swear, RxJS is going to be the death of me. I'm pretty sure this is an actual bug with either RxJS, Typescript, or Angular's implementation of either. This works on the RxJS docs page (the javascript console on that page works as an RxJS sandbox):
new Rx.Observable(observer => observer.next([{
id: 0,
name: 'John Doe'
}, {
id: 1,
name: 'Jane Smith'
}]))
.map(data => data.filter(item => item.name === 'John Doe'))
.subscribe(data => console.log(data), err => console.log(err))
But the exact same code is giving me the error Property 'filter' does not exist on type '{}'. in my Angular application. Referencing the data.filter part. data at that point is most definitely an array, so I really can't figure out why it doesn't think so.
I have updated the version of rxjs that the application is using, but that didn't change anything. Any assistance would be greatly appreciated. RxJS is already difficult enough without these inconsistencies!
datashould be of typeany. It seems to be caused by Rx. Not sure if it is by design. Anyway to fix it you could add type of your data wrapped in the observable, likenew Rx.Observable<any[]>.