extending an ES6 class using ES5 syntax?

John Lenz concavelenz at gmail.com
Sat May 14 00:52:48 UTC 2016


Specifically, I'm looking for a way to call an super class ES6 constructor
without violating the "new" rule (TypeError: Class constructor A cannot be
invoked without 'new'):

class A {
}

function B() {
  A.call(this);  // this breaks
}
B.prototype = Object.create(A.prototype);


Without something like this, it isn't possible to migrate a large code base
except "leaves" first. Which is a bad place to be.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20160513/31b692af/attachment.html>


More information about the es-discuss mailing list