1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
tests/cases/compiler/typeParametersShouldNotBeEqual2.ts(4,5): error TS2322: Type 'U' is not assignable to type 'T'.
Type 'Date' is not assignable to type 'T'.
tests/cases/compiler/typeParametersShouldNotBeEqual2.ts(5,5): error TS2322: Type 'V' is not assignable to type 'T'.
tests/cases/compiler/typeParametersShouldNotBeEqual2.ts(6,5): error TS2322: Type 'T' is not assignable to type 'V'.
Type 'Date' is not assignable to type 'V'.
tests/cases/compiler/typeParametersShouldNotBeEqual2.ts(7,5): error TS2322: Type 'V' is not assignable to type 'U'.
tests/cases/compiler/typeParametersShouldNotBeEqual2.ts(8,5): error TS2322: Type 'U' is not assignable to type 'V'.
Type 'Date' is not assignable to type 'V'.
tests/cases/compiler/typeParametersShouldNotBeEqual2.ts(9,5): error TS2322: Type 'Object' is not assignable to type 'T'.
The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
==== tests/cases/compiler/typeParametersShouldNotBeEqual2.ts (6 errors) ====
function ff<T extends Date, U extends Date, V>(x: T, y: U, z: V) {
var zz: Object;
x = x; // Ok
x = y; // Ok
~
!!! error TS2322: Type 'U' is not assignable to type 'T'.
!!! error TS2322: Type 'Date' is not assignable to type 'T'.
x = z; // Error
~
!!! error TS2322: Type 'V' is not assignable to type 'T'.
z = x; // Error
~
!!! error TS2322: Type 'T' is not assignable to type 'V'.
!!! error TS2322: Type 'Date' is not assignable to type 'V'.
y = z; // Error
~
!!! error TS2322: Type 'V' is not assignable to type 'U'.
z = y; // Error
~
!!! error TS2322: Type 'U' is not assignable to type 'V'.
!!! error TS2322: Type 'Date' is not assignable to type 'V'.
x = zz; // Error
~
!!! error TS2322: Type 'Object' is not assignable to type 'T'.
!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
zz = x; // Ok
}
|