I am testing the following code on Chrome Canary 63 and Chrome 61. The purpose of the code is to set a method that calls super on an instance of class ( z ). In my code base, sometimes blocks of property blocks are cloned from Object.assign before being added to the instance, and whenever this happens, the code crashes.
I reproduced the problem with the code example below. The code works fine if you avoid minor cloning ( props = Object.assign({}, props); ), but if I add this line, I get TypeError: (intermediate value).bar is not a function .
I tried doing Object.create(this, Object.getOwnPropertyDescriptors(props)) instead of Object.assign , but this leads to the same error.
Is there a way to correctly set super on cloned objects?
let Moo = class { bar() { return " [bar on Moo] "; } }; let Zoo = class extends Moo { bar() { return " [bar on Zoo] " + super.bar(); } }; function addProps(inst, props) {
Jarym source share