TypeScript/tests/baselines/reference/genericTypeAssertions6.errors.txt
2014-09-12 13:35:07 -07:00

36 lines
1.3 KiB
Plaintext

tests/cases/compiler/genericTypeAssertions6.ts(8,13): error TS2352: Neither type 'U' nor type 'T' is assignable to the other.
tests/cases/compiler/genericTypeAssertions6.ts(9,13): error TS2352: Neither type 'T' nor type 'U' is assignable to the other.
tests/cases/compiler/genericTypeAssertions6.ts(19,17): error TS2352: Neither type 'U' nor type 'T' is assignable to the other.
==== tests/cases/compiler/genericTypeAssertions6.ts (3 errors) ====
class A<T,U> {
constructor(x) {
var y = <T>x;
var z = <U>x;
}
f(x: T, y: U) {
x = <T>y;
~~~~
!!! error TS2352: Neither type 'U' nor type 'T' is assignable to the other.
y = <U>x;
~~~~
!!! error TS2352: Neither type 'T' nor type 'U' is assignable to the other.
}
}
class B<T extends Date, U extends Date> extends A<T, U> {
g(x: T) {
var a: Date = x;
var b = <Date>x;
var c = <T>new Date();
var d = <U>new Date();
var e = <T><U>new Date();
~~~~~~~~~~~~~~~~
!!! error TS2352: Neither type 'U' nor type 'T' is assignable to the other.
}
}
var b: B<Date, Date>;
var c: A<Date, Date> = <A<Date, Date>>b;