mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
fix: import individual rx operators (#8160)
After the switch to lettable operators, we had started importing all operators via `rxjs/operators`. These changes switch us back to only importing the individual ones and add some linting so it doesn't happen in the future.
This commit is contained in:
committed by
Andrew Seguin
parent
e0eda5a9ce
commit
de8c6e2881
+2
-2
@@ -128,7 +128,7 @@ class ConfigBuilder {
|
||||
|
||||
#### RxJS
|
||||
When dealing with RxJS operators, import the lettable operator (e.g.
|
||||
`import {map} from 'rxjs/operators'`), as opposed to using the "patch" imports which pollute the
|
||||
`import {map} from 'rxjs/operators/map'`), as opposed to using the "patch" imports which pollute the
|
||||
user's global Observable object (e.g. `import 'rxjs/add/operator/map'`):
|
||||
|
||||
```ts
|
||||
@@ -137,7 +137,7 @@ import 'rxjs/add/operator/map';
|
||||
someObservable.map(...).subscribe(...);
|
||||
|
||||
// YES
|
||||
import {map} from 'rxjs/operators';
|
||||
import {map} from 'rxjs/operators/map';
|
||||
someObservable.pipe(map(...)).subscribe(...);
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user