Aliased object destructuring assignments?

Sebastian McKenzie sebmck at
Mon Jun 22 00:53:22 UTC 2015

The syntax is indeed invalid, but syntax does exist to do the equivalent:


var { f: foo } = someObject;


On Mon, Jun 22, 2015 at 1:50 AM, Salehen Rahman <salehen.rahman at>

> I know that `import` allows us to alias imports, like so:
> ```javascript
> import { f as foo } from 'f';
> ```
> But what about object destructuring assignments?
> ```javascript
> var { f as foo } = someObject; // Syntax error on Babel
> ```
> Either Babel is very late in the game, or the above syntax is actually not
> supported in ECMAScript.
> It would be really beneficial to support aliasing for object destructuring.
> I find it would make sense since array destructuring assignments allow us
> to assign values to arbitrary variable names.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list