I stumbled onto a peculiarity with JavaScript, not sure if it is by design or a bug in the Chrome browser. If the base class has both a get and set property accessor with the same name, the inherited class can not override just one, it must override both.
class Class1 {
constructor() {
this._item = 1;
}
set item(value) {
this._item = value;
}
get item() {
return this._item;
}
}
class Class2 extends Class1 {
constructor() {
super();
this._item = 2;
}
set item(value) {
this._item = value;
}
}
let c1 = new Class1();
let item1 = c1.item; // item1 is 1
console.log(item1);
let c2 = new Class2();
let item2 = c2.item; // item2 should be 2, but is undefined
console.log(item2);