import {x with x() as y}

Frankie Bagnardi f.bagnardi at
Sat Aug 1 12:55:13 UTC 2015

There are often situations where the export of a module is only needed as
an argument to another function, or for its return value.

import _temp1 from 'debug';
let debug = _temp1('foo');

import {readFile as _temp2} from 'fs';
let readFile = promisify(_temp2);

import _temp3, {Router} from 'express';
let app = _temp3();

This juggling could be avoided by allowing usage of the exports without
binding them locally. Something like this:

import {default with default('foo') as debug} from 'debug';

import  {readFile with promisify(readFile) as readFile} from 'fs';

import {Router, default with default() as app} from 'express';

Has this been brought up before? Thoughts?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list