mirror of
https://github.com/swc-project/swc.git
synced 2024-12-25 06:36:08 +03:00
14 lines
270 B
TypeScript
14 lines
270 B
TypeScript
// @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
|