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

39 lines
2.6 KiB
Text
Raw Normal View History

tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints3.ts(3,12): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints3.ts(5,13): error TS2367: No best common type exists between 'T' and 'U'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints3.ts(6,13): error TS2367: No best common type exists between 'U' and 'T'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints3.ts(9,14): error TS2367: No best common type exists between 'T' and 'V'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints3.ts(10,14): error TS2367: No best common type exists between 'V' and 'T'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints3.ts(13,14): error TS2367: No best common type exists between 'V' and 'U'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints3.ts(14,14): error TS2367: No best common type exists between 'U' and 'V'.
2014-07-13 01:04:16 +02:00
==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints3.ts (7 errors) ====
// checking whether other types are subtypes of type parameters with constraints
function f<T extends U, U, V>(t: T, u: U, v: V) {
~~~~~~~~~~~
!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
2014-07-13 01:04:16 +02:00
// ok
var r = true ? t : u;
~~~~~~~~~~~~
!!! error TS2367: No best common type exists between 'T' and 'U'.
2014-07-13 01:04:16 +02:00
var r = true ? u : t;
~~~~~~~~~~~~
!!! error TS2367: No best common type exists between 'U' and 'T'.
2014-07-13 01:04:16 +02:00
// error
var r2 = true ? t : v;
~~~~~~~~~~~~
!!! error TS2367: No best common type exists between 'T' and 'V'.
2014-07-13 01:04:16 +02:00
var r2 = true ? v : t;
~~~~~~~~~~~~
!!! error TS2367: No best common type exists between 'V' and 'T'.
2014-07-13 01:04:16 +02:00
// error
var r3 = true ? v : u;
~~~~~~~~~~~~
!!! error TS2367: No best common type exists between 'V' and 'U'.
2014-07-13 01:04:16 +02:00
var r3 = true ? u : v;
~~~~~~~~~~~~
!!! error TS2367: No best common type exists between 'U' and 'V'.
2014-07-13 01:04:16 +02:00
}