Although I've been utilizing rxjs with Typescript by importing it as follows:
import * as rx from 'rxjs/Rx';
var stream: rx.Subject<boolean> = new rx.Subject<boolean>();
While this approach works, I am now interested in implementing tree-shaking and it seems that "patching" imports [1] is the way to achieve this. Therefore, I could modify my import statement like so:
import {Subject} from 'rxjs/Subject';
var stream: Subject<boolean> = new Subject<boolean>();
This solution is satisfactory, but I wish to maintain the symbol names within rxjs under a shared prefix (e.g., rx.Subject). However, based on how the ES6 import statement functions, there doesn't appear to be an obvious way of accomplishing this [2]. Ideally, I would prefer something similar to:
import {Subject} as rx from 'rxjs/Subject';
or any other syntax that enables me to achieve the same outcome.
Is there a specific syntax or conventional method for achieving this?
1: http://reactivex.io/rxjs/manual/installation.html 2: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import