I’m not sure it’s okay to reply on this very old thread, but if I’m understanding correctly the desugared code can be fairly short with new Object.getOwnPropertyDescriptors:
```js function partial(base, extension) { extension.prototype.__proto__ = base.prototype.__proto__; // to enable 'super' reference const descriptors = Object.getOwnPropertyDescriptors(extension.prototype); delete descriptors.constructor; // must not override constructor Object.defineProperties(base.prototype, descriptors); return base; } ``` ``` class A { foo() { return "foo" } } class B extends A { } partial(B, class { foobar() { return `${super.foo()}bar`; } }) output.value = new B().foobar(); // will be “foobar; ``` This sample currently only works on Firefox 50+. https://jsfiddle.net/v8bbvavv/ Sent from Mail for Windows 10
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss