Closed
Description
Bug, feature request, or proposal:
All internal usages of Observable / RxJS operators should use the non-patch syntax for imports.
What is the expected behavior?
Usages of RxJS operators should use the "longhand" syntax, which avoids polluting the Observable.prototype in userland:
//desired syntax
import {Observable} from 'rxjs/Observable'
import {map} from 'rxjs/operator/map'
map.call(sourceObservable, (x) => x + 1).subscribe(...)
What is the current behavior?
//current syntax
import {Observable} from 'rxjs/Observable'
import 'rxjs/add/operator/map'
sourceObservable.map((x) => x + 1).subscribe(...)
What is the use-case or motivation for changing an existing behavior?
Currently the "patch" operators are used, which pollute the Observable prototype and can lead to unexpected results if, for example, Material uses the .map() operator today, and then removes it in the future. If a user uses .map()
without explicitly importing it, their app would break upon removal by Material.
Which versions of Angular, Material, OS, browsers are affected?
Is there anything else we should know?
Sample of correct usage in Router : https://github.com/angular/angular/blob/52be848f94a70feffd44a1d688286f750d0471d9/modules/%40angular/router/src/router_config_loader.ts#L34
Metadata
Metadata
Assignees
Labels
No labels