TypeScript/tests/baselines/reference/getAndSetNotIdenticalType3.errors.txt
2014-07-12 17:30:19 -07:00

31 lines
929 B
Plaintext

==== tests/cases/compiler/getAndSetNotIdenticalType3.ts (5 errors) ====
class A<T> { foo: T; }
class C<T> {
data: A<number>;
get x(): A<number> {
~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
~~~~~~~~~~~~~~~~~~~~
return this.data;
~~~~~~~~~~~~~~~~~~~~~~~~~
}
~~~~~
!!! 'get' and 'set' accessor must have the same type.
set x(v: A<string>) {
~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
~~~~~~~~~~~~~~~~~~~~~
this.data = v;
~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~
!!! Type 'A<string>' is not assignable to type 'A<number>':
!!! Type 'string' is not assignable to type 'number'.
}
~~~~~
!!! 'get' and 'set' accessor must have the same type.
}
var x = new C();
var r = x.x;
x.x = r;