I'm migrating to [email protected]
and using lettable operators... I also update Observable
static methods. I wonder what is the counterpart of Observable.throw
and import 'rxjs/add/observable/throw';
.
Should I import ugly _throw
?
import { _throw } from 'rxjs/observable/throw';
Or there's a better way. Honestly I liked static methods on Observable
, and now it seems that all static creating methods like of
, from
should be imported from rxjs/observable/<methodName>
?
Observable. if has been replaced by iif() and Observable. throw is now throwError() .
I'm still getting my head round 5.5 but it looks like now instead of importing throw use ErrorObservable.
// import { _throw } from 'rxjs/observable/throw'; import { ErrorObservable } from 'rxjs/observable/ErrorObservable'; ErrorObservable.create('error');
From this guide it looks like it has to be _throw to avoid a keyword clash (the rest of the video is good for getting started with 5.5)
In continuation to Mick's answer, in the rxjs version 6 _throw
is replaced by throwError
import {Observable, throwError} from 'rxjs';
RxJS Migration Guide
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With