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

29 lines
591 B
Plaintext

==== tests/cases/compiler/genericCloneReturnTypes.ts (1 errors) ====
class Bar<T> {
public size: number;
public t: T;
constructor(x: number) {
this.size = x;
}
public clone() {
return new Bar<T>(this.size);
}
}
var b: Bar<number>;
var b2 = b.clone();
var b3: Bar<string>;
b = b2;
b = b3;
~
!!! Type 'Bar<string>' is not assignable to type 'Bar<number>':
!!! Type 'string' is not assignable to type 'number'.