Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular/rxjs: Why don't I have to import toPromise anymore? [closed]

A ton of SO answers say that to avoid problems like

Property 'toPromise' does not exist on type 'Observable'

in Angular, you have to import 'rxjs/add/operator/toPromise' which I've done until recently. In an Angular 4.2.4 project, I forgot the import and expected to see an error. It wasn't there! I did some debugging in Chrome's dev tools and saw "toPromise" on the Observable's prototype.

My question is ... how did that get there? Is this a new addition to TypeScript, Angular, or rxjs?

like image 226
Rap Avatar asked Oct 19 '17 20:10

Rap


1 Answers

As of rxjs 5.5.0-beta.5

toPromise: now exists as a permanent method on Observable (2e49a5c)

https://github.com/ReactiveX/rxjs/blob/master/CHANGELOG.md#550-beta5-2017-10-06

like image 170
LLai Avatar answered Sep 23 '22 23:09

LLai