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