Reactive-Extensions / RxJS

The Reactive Extensions for JavaScript
http://reactivex.io
Other
19.49k stars 2.1k forks source link

Import of switchMap from rxjs/operators is not working. #1534

Closed daBishMan closed 6 years ago

daBishMan commented 6 years ago

Hello all,

I have the following code: this.companyAutoSuggestDataProvider$ = Observable.create((observer: any) => { observer.next(this.searchParams.company); }).switchMap((company: string) => this.getAutoSuggestResults(company, AutoSuggestResultType.Company, 10));

if I import (import { switchMap } from 'rxjs/operators';) the above code fails, saying switchMap is not a function.

but if I import (import 'rxjs/add/operator/switchMap';) it works.

am I doing something wrong or is this a bug?

daBishMan commented 6 years ago

@benlesh was kinda enough to say that anything that is being used outside of pipe method, will need to be imported "old style" basically.

I am closing this but I figured I put the answer here just in case someone else wanted to know.