Promise sub-class: super((resolve, reject) => this) ?

Sebastian McKenzie sebmck at gmail.com
Tue Jun 2 22:40:24 UTC 2015


This is a limitation of Babel and not at all a reflection of the actual specification. This restriction is imposed order to follow ES2015 semantics of not being able to reference `this` before `super()`. It does a pretty dumb check of only allowing it to be strictly after the call (ie. not before or inside it). Note that this is also the behaviour of Traceur and TypeScript so Babel is not alone with this decision. You can see extensive discussion of this in the issue: https://github.com/babel/babel/issues/1131

On Tue, Jun 2, 2015 at 11:36 PM, Matthew Robb <matthewwrobb at gmail.com>
wrote:

> I was trying to demonstrate a simple method of exposing resolve and reject
> functions to someone and noticed in Babel at least you cannot do this. It
> seems as though in this case when the arrow function is called it will have
> been AFTER the call to super.
> Can someone help me understand what's going on here?
> - Matthew Robb
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150602/cff027fb/attachment.html>


More information about the es-discuss mailing list