TypeScript/tests/baselines/reference/typeParameterAssignability.errors.txt

15 lines
808 B
Plaintext
Raw Normal View History

2014-11-05 21:26:03 +01:00
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability.ts(4,5): error TS2322: Type 'U' is not assignable to type 'T'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability.ts(5,5): error TS2322: Type 'T' is not assignable to type 'U'.
2014-07-13 01:04:16 +02:00
==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability.ts (2 errors) ====
// type parameters are not assignable to one another unless directly or indirectly constrained to one another
function foo<T, U>(t: T, u: U) {
t = u; // error
~
2014-11-05 21:26:03 +01:00
!!! error TS2322: Type 'U' is not assignable to type 'T'.
2014-07-13 01:04:16 +02:00
u = t; // error
~
2014-11-05 21:26:03 +01:00
!!! error TS2322: Type 'T' is not assignable to type 'U'.
2014-07-13 01:04:16 +02:00
}