-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Now that lettable operators are coming (#2667) to get rid of the import 'rxjs/add/operator/xyz' mess, the static Observable methods for creation (of, timer, ...) and composition (merge, zip, ...) will probably need the same treatment to get rid of import 'rxjs/add/observable/xyz'.
I didn't find any issue or PR for this (probably not in scope of #2667, judging by the title and current commits), but I'm sure @benlesh has some ideas already?
It already seems to be possible to import these static methods properly using import { merge } from 'rxjs/observable/merge' etc, although this is not documented in the installation section of the docs.
However, if I didn't miss anything this approach seems quite clunky because
- each method requires a separate import statement
- the imports are not available on one central object like they are on
Observablewhen using theadd/observableimports - resulting from 2, they may need to be aliased because e.g.
mergeis a very generic name that does not convey correlation with RxJS
My personal comments on this:
1 could be resolved by centralizing the exports of the static methods similar to the rxjs/operators from #2667
2 does not appear to have an obvious solution, unfortunately there is no import { merge, zip } as ObservableFactoryThingy unless you're importing everything (*)
3 is probably not a large problem, especially since the same thing will apply for lettable operators (map, min etc). I certainly don't think it justifies exporting them as observableOf, mergeObservables etc instead. Either way, a possible solution to 2 might resolve 3 as well.