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

15 lines
No EOL
808 B
Text

tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability.ts(4,5): error TS2323: Type 'U' is not assignable to type 'T'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability.ts(5,5): error TS2323: 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 TS2323: Type 'U' is not assignable to type 'T'.
u = t; // error
~
!!! error TS2323: Type 'T' is not assignable to type 'U'.
}