typescript - Possible to import member into a nested name -


i have been using rxjs typescript using import like:

import * rx 'rxjs/rx';  var stream: rx.subject<boolean> = new rx.subject<boolean>(); 

this works tree-shaking , looks likes way through "patching" imports [1]. based upon import code this:

import {subject} 'rxjs/subject'; var stream: subject<boolean> = new subject<boolean>(); 

this great, keep symbol names inside of rxjs nested inside common prefix. (ex: rx.subject). see of how es6 import statement works there no obvious way [2]. like:

import {subject} rx 'rxjs/subject'; 

or other similar syntax allow this.

does know syntax use or common pattern people use this?

1: http://reactivex.io/rxjs/manual/installation.html 2: https://developer.mozilla.org/en-us/docs/web/javascript/reference/statements/import

you can create module re-exports symbols need rx. suppose name rx-subset.ts:

export {subject} 'rxjs/subject';  // on 

then can use everywhere in source code instead of rx this:

import * rx './rx-subset'  // here can use rx.subject 

Comments

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -