87 lines
3.4 KiB
Plaintext
87 lines
3.4 KiB
Plaintext
tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithAny.ts(3,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithAny.ts(9,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithAny.ts(19,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithAny.ts(27,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithAny.ts(38,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithAny.ts(44,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithAny.ts(57,1): error TS2322: Type 'E' is not assignable to type 'C'.
|
|
Types of property 'x' are incompatible.
|
|
Type 'string' is not assignable to type 'number'.
|
|
|
|
|
|
==== tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithAny.ts (7 errors) ====
|
|
class C {
|
|
x: number;
|
|
get X(): number { return 1; }
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
foo(): number {
|
|
return 1;
|
|
}
|
|
|
|
static y: number;
|
|
static get Y(): number {
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
return 1;
|
|
}
|
|
static bar(): number {
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
class D extends C {
|
|
x: any;
|
|
get X(): any {
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
return null;
|
|
}
|
|
foo(): any {
|
|
return 1;
|
|
}
|
|
|
|
static y: any;
|
|
static get Y(): any {
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
return null;
|
|
}
|
|
static bar(): any {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
// if D is a valid class definition than E is now not safe tranisitively through C
|
|
class E extends D {
|
|
x: string;
|
|
get X(): string{ return ''; }
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
foo(): string {
|
|
return '';
|
|
}
|
|
|
|
static y: string;
|
|
static get Y(): string {
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
return '';
|
|
}
|
|
static bar(): string {
|
|
return '';
|
|
}
|
|
}
|
|
|
|
var c: C;
|
|
var d: D;
|
|
var e: E;
|
|
|
|
c = d;
|
|
c = e;
|
|
~
|
|
!!! error TS2322: Type 'E' is not assignable to type 'C'.
|
|
!!! error TS2322: Types of property 'x' are incompatible.
|
|
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
|
var r = c.foo(); // e.foo would return string
|
|
|