Reputation: 41
I want something like this:
import {get, set} as moduleName from 'module-name'
moduleName.get()
The reason is because sometimes methods of different modules can have the same name, and I don't want to import the whole module because of it
Upvotes: 3
Views: 2675
Reputation: 1444
There is no such thing as:
import {get, set} as moduleName from 'module-name'
You can either do it like this:
import * as moduleName from 'module-name';
moduleName.get(); //all the exported items will be accessible.
Or this:
import {get as moduleNameGet, set as moduleNameSet} from 'module-name';
moduleNameGet();
Upvotes: 2
Reputation: 545
You can use below syntax
import * as module from "module-name";
Upvotes: 0