swc/crates/swc_ecma_parser/tests/tsc/propertyOverridesAccessors2.ts

14 lines
270 B
TypeScript
Raw Normal View History

// @target: esnext
// @useDefineForClassFields: true
class Base {
get x() { return 2; }
set x(value) { console.log(`x was set to ${value}`); }
}
class Derived extends Base {
x = 1;
}
const obj = new Derived(); // prints 'x was set to 1'
console.log(obj.x); // 2