1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
//// [tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability.ts] ////
//// [typeParameterAssignability.ts]
// 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
u = t; // error
}
//// [typeParameterAssignability.js]
// type parameters are not assignable to one another unless directly or indirectly constrained to one another
function foo(t, u) {
t = u; // error
u = t; // error
}
|