15 lines
808 B
Plaintext
15 lines
808 B
Plaintext
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'.
|
|
|
|
|
|
==== 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
|
|
~
|
|
!!! error TS2322: Type 'U' is not assignable to type 'T'.
|
|
u = t; // error
|
|
~
|
|
!!! error TS2322: Type 'T' is not assignable to type 'U'.
|
|
} |