In Angular 2 using rxjs I was trying to convert a Promise to Observable. As many of online guides showed I used fromPromise
on Observable
. Which throws error:
Property 'fromPromise' does not exist on type 'typeof Observable'.
Observable was imported like:
import { Observable } from "rxjs/Observable";
trying to import fromPromise
like other operators results in error:
import 'rxjs/add/operator/fromPromise';
even if I suppress typescript error it still results in error:
(<any>Observable).fromPromise
Error:
Uncaught (in promise): TypeError: __WEBPACK_IMPORTED_MODULE_3_rxjs_Observable__.Observable.fromPromise is not a function
Somewhat similar issue was reported on rxjs repo here but there is no solution there either.