55 lines
No EOL
1.6 KiB
Text
55 lines
No EOL
1.6 KiB
Text
==== tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts (6 errors) ====
|
|
module NonGeneric {
|
|
class C {
|
|
x: string;
|
|
get y() {
|
|
~
|
|
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
|
return 1;
|
|
}
|
|
set y(v) { }
|
|
~
|
|
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
|
fn() { return this; }
|
|
constructor(public a: number, private b: number) { }
|
|
}
|
|
|
|
class D extends C { e: string; }
|
|
|
|
var d = new D(1, 2);
|
|
var r = d.fn();
|
|
var r2 = r.x;
|
|
var r3 = r.y;
|
|
r.y = 4;
|
|
var r6 = d.y(); // error
|
|
~~~~~
|
|
!!! Cannot invoke an expression whose type lacks a call signature.
|
|
|
|
}
|
|
|
|
module Generic {
|
|
class C<T, U> {
|
|
x: T;
|
|
get y() {
|
|
~
|
|
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
|
return null;
|
|
}
|
|
set y(v: U) { }
|
|
~
|
|
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
|
fn() { return this; }
|
|
constructor(public a: T, private b: U) { }
|
|
}
|
|
|
|
class D<T, U> extends C<T, U> { e: T; }
|
|
|
|
var d = new D(1, '');
|
|
var r = d.fn();
|
|
var r2 = r.x;
|
|
var r3 = r.y;
|
|
r.y = '';
|
|
var r6 = d.y(); // error
|
|
~~~~~
|
|
!!! Cannot invoke an expression whose type lacks a call signature.
|
|
} |