18 lines
743 B
Plaintext
18 lines
743 B
Plaintext
tests/cases/conformance/classes/propertyMemberDeclarations/accessorsOverrideProperty2.ts(6,7): error TS2611: 'x' is defined as a property in class 'Base', but is overridden here in 'Derived' as an accessor.
|
|
|
|
|
|
==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorsOverrideProperty2.ts (1 errors) ====
|
|
class Base {
|
|
x = 1;
|
|
}
|
|
|
|
class Derived extends Base {
|
|
get x() { return 2; } // should be an error
|
|
~
|
|
!!! error TS2611: 'x' is defined as a property in class 'Base', but is overridden here in 'Derived' as an accessor.
|
|
set x(value) { console.log(`x was set to ${value}`); }
|
|
}
|
|
|
|
const obj = new Derived(); // nothing printed
|
|
console.log(obj.x); // 1
|
|
|