Rxjs 5.5 “ Property ‘map’ does not exist on type Observable…’”

Damian
Coding Snippets
Published in
1 min readNov 17, 2017

I’ve just converted an Ionic app to Angular 5 which relies on rxjs 5.5+. One of the odd errors that i found and didn’t quite understand why was “Property ‘map’ does not exist on type Observable” (or any operator like take or tap).

It took a moment to realize that the problem was related to the fact that you need to add pipe around all operators. So this:

this.myObservable().map(data => {})

becomes this:

this.myObservable().pipe(map(data => {}))

And with your operators you need to switch to using lettable operators by switching from an import like this:

import 'rxjs/add/operator/map';

to this:

import { map } from "rxjs/operators";

Also worth noting that the operator “do” has been changed to “tap” in rxjs 5.5 (and many others). This is after it was changed from “tap” to “do” in the migration of rxjs 4 to 5 (ngWat @shai_reznik). In the world of Javascript this stuff is moving so fast it almost not worth writing a blog post on it as it has likely changed already.

--

--

Damian
Coding Snippets

I’m a software architect for my day job and work on a lot of side projects around mobile tech in my free time.