14 lines
410 B
Plaintext
14 lines
410 B
Plaintext
==== tests/cases/compiler/genericGetter.ts (2 errors) ====
|
|
class C<T> {
|
|
data: T;
|
|
get x(): T {
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
return this.data;
|
|
}
|
|
}
|
|
|
|
var c = new C<number>();
|
|
var r: string = c.x;
|
|
~
|
|
!!! error TS2323: Type 'number' is not assignable to type 'string'. |