2014-07-13 01:04:16 +02:00
|
|
|
==== tests/cases/compiler/inheritanceMemberAccessorOverridingMethod.ts (4 errors) ====
|
|
|
|
class a {
|
|
|
|
x() {
|
|
|
|
return "20";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class b extends a {
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2416: Class 'b' incorrectly extends base class 'a':
|
|
|
|
!!! error TS2416: Types of property 'x' are incompatible:
|
|
|
|
!!! error TS2416: Type 'string' is not assignable to type '() => string'.
|
2014-07-13 01:04:16 +02:00
|
|
|
get x() {
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
2014-07-13 01:04:16 +02:00
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2423: Class 'a' defines instance member function 'x', but extended class 'b' defines it as instance member accessor.
|
2014-07-13 01:04:16 +02:00
|
|
|
return "20";
|
|
|
|
}
|
|
|
|
set x(aValue: string) {
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|