Rxjs operators not working after NS 3.4 update


Along with the update to NS 3.4 and angular 5.0, the rxjs dependency has been updated to 5.5.2. This version of rxjs uses a different syntax for imports, outlined here: https://github.com/ReactiveX/rxjs/blob/master/doc/lettable-operators.md.

However, this new syntax doesn’t appear to work with this latest version of NS. For example, importing the startWith operator and attempting to use it results in this output:

CONSOLE ERROR [native code]: ERROR TypeError: this.myObservable.startWith is not a function. (In 'this.myObservable.startWith(this.searchText)', 'this.myObservable.startWith' is undefined)
CONSOLE ERROR [native code]: ERROR CONTEXT [object Object]

Has any one else experienced this?


Is anyone able to successfully import rxjs operators? The old syntax doesn’t work for me either in this latest version, so I don’t have a workaround of any type.


You need to import them individually. For example, you can import switchMap with:

import 'rxjs/add/operator/switchMap';

if you import them as lettable operators you need to use them with the pipe operator. I haven’t used them much myself but here is a good blog post about using them. https://blog.hackages.io/rxjs-5-5-piping-all-the-things-9d469d1b3f44


The lettable operator syntax is meant to encompass the new pipe syntax:

   startsWith(res => res),
   catchError(error => of(error)

Where you would have imported both the startsWith and catchError operator in that file.

The old approach should work, where you have all your operator imports in a single file (i.e. operators.ts) and import that into your root app component:

// any operators needed throughout your application
import './operators';


Thanks to both of you for clearing that up. I believe I was previously importing everything from a path that doesn’t support such a thing in the latest rxjs version. Importing individual operators within a single file works great, and resolves the typeError I was seeing.


hey guys im facing Am facing the same problem. Hope anyone here can help me too. Thanks in advance. Regards,