216 lines
14 KiB
Plaintext
216 lines
14 KiB
Plaintext
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(3,17): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(4,5): error TS2322: Type 'U' is not assignable to type 'T'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(5,5): error TS2322: Type 'T' is not assignable to type 'U'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(8,15): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(9,5): error TS2322: Type 'U' is not assignable to type 'T'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(10,5): error TS2322: Type 'T' is not assignable to type 'U'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(13,15): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(13,28): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(14,5): error TS2322: Type 'U' is not assignable to type 'T'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(15,5): error TS2322: Type 'T' is not assignable to type 'U'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(17,5): error TS2322: Type 'V' is not assignable to type 'T'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(18,5): error TS2322: Type 'T' is not assignable to type 'V'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(20,5): error TS2322: Type 'V' is not assignable to type 'U'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(21,5): error TS2322: Type 'U' is not assignable to type 'V'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(24,15): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(24,28): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(25,5): error TS2322: Type 'U' is not assignable to type 'T'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(26,5): error TS2322: Type 'V' is not assignable to type 'T'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(27,5): error TS2322: Type 'Date' is not assignable to type 'T'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(29,5): error TS2322: Type 'T' is not assignable to type 'U'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(30,5): error TS2322: Type 'V' is not assignable to type 'U'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(31,5): error TS2322: Type 'Date' is not assignable to type 'U'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(33,5): error TS2322: Type 'T' is not assignable to type 'V'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(34,5): error TS2322: Type 'U' is not assignable to type 'V'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(35,5): error TS2322: Type 'Date' is not assignable to type 'V'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(38,5): error TS2322: Type 'T' is not assignable to type 'Date'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(39,5): error TS2322: Type 'U' is not assignable to type 'Date'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(44,31): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(44,44): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(45,5): error TS2322: Type 'U' is not assignable to type 'T'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(46,5): error TS2322: Type 'V' is not assignable to type 'T'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(47,5): error TS2322: Type 'Date' is not assignable to type 'T'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(49,5): error TS2322: Type 'T' is not assignable to type 'U'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(50,5): error TS2322: Type 'V' is not assignable to type 'U'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(51,5): error TS2322: Type 'Date' is not assignable to type 'U'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(53,5): error TS2322: Type 'T' is not assignable to type 'V'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(54,5): error TS2322: Type 'U' is not assignable to type 'V'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(55,5): error TS2322: Type 'Date' is not assignable to type 'V'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(58,5): error TS2322: Type 'T' is not assignable to type 'Date'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(59,5): error TS2322: Type 'U' is not assignable to type 'Date'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(63,15): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(64,5): error TS2322: Type 'U' is not assignable to type 'T'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(65,5): error TS2322: Type 'V' is not assignable to type 'T'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(67,5): error TS2322: Type 'T' is not assignable to type 'U'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(68,5): error TS2322: Type 'V' is not assignable to type 'U'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(70,5): error TS2322: Type 'T' is not assignable to type 'V'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(71,5): error TS2322: Type 'U' is not assignable to type 'V'.
|
|
|
|
|
|
==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts (47 errors) ====
|
|
// type parameters are not assignable to one another unless directly or indirectly constrained to one another
|
|
|
|
function foo<T, U extends T>(t: T, u: U) {
|
|
~~~~~~~~~~~
|
|
!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
t = u; // error
|
|
~
|
|
!!! error TS2322: Type 'U' is not assignable to type 'T'.
|
|
u = t; // ok
|
|
~
|
|
!!! error TS2322: Type 'T' is not assignable to type 'U'.
|
|
}
|
|
|
|
function foo2<T extends U, U>(t: T, u: U) {
|
|
~~~~~~~~~~~
|
|
!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
t = u; // error
|
|
~
|
|
!!! error TS2322: Type 'U' is not assignable to type 'T'.
|
|
u = t; // ok
|
|
~
|
|
!!! error TS2322: Type 'T' is not assignable to type 'U'.
|
|
}
|
|
|
|
function foo3<T extends U, U extends V, 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.
|
|
~~~~~~~~~~~
|
|
!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
t = u; // error
|
|
~
|
|
!!! error TS2322: Type 'U' is not assignable to type 'T'.
|
|
u = t;
|
|
~
|
|
!!! error TS2322: Type 'T' is not assignable to type 'U'.
|
|
|
|
t = v; // error
|
|
~
|
|
!!! error TS2322: Type 'V' is not assignable to type 'T'.
|
|
v = t; // ok
|
|
~
|
|
!!! error TS2322: Type 'T' is not assignable to type 'V'.
|
|
|
|
u = v; // error
|
|
~
|
|
!!! error TS2322: Type 'V' is not assignable to type 'U'.
|
|
v = u; // ok
|
|
~
|
|
!!! error TS2322: Type 'U' is not assignable to type 'V'.
|
|
}
|
|
|
|
function foo4<T extends U, U extends V, V extends Date>(t: T, u: U, v: V) {
|
|
~~~~~~~~~~~
|
|
!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
~~~~~~~~~~~
|
|
!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
t = u; // error
|
|
~
|
|
!!! error TS2322: Type 'U' is not assignable to type 'T'.
|
|
t = v; // error
|
|
~
|
|
!!! error TS2322: Type 'V' is not assignable to type 'T'.
|
|
t = new Date(); // error
|
|
~
|
|
!!! error TS2322: Type 'Date' is not assignable to type 'T'.
|
|
|
|
u = t;
|
|
~
|
|
!!! error TS2322: Type 'T' is not assignable to type 'U'.
|
|
u = v; // error
|
|
~
|
|
!!! error TS2322: Type 'V' is not assignable to type 'U'.
|
|
u = new Date(); // error
|
|
~
|
|
!!! error TS2322: Type 'Date' is not assignable to type 'U'.
|
|
|
|
v = t;
|
|
~
|
|
!!! error TS2322: Type 'T' is not assignable to type 'V'.
|
|
v = u;
|
|
~
|
|
!!! error TS2322: Type 'U' is not assignable to type 'V'.
|
|
v = new Date(); // ok
|
|
~
|
|
!!! error TS2322: Type 'Date' is not assignable to type 'V'.
|
|
|
|
var d: Date;
|
|
d = t; // ok
|
|
~
|
|
!!! error TS2322: Type 'T' is not assignable to type 'Date'.
|
|
d = u; // ok
|
|
~
|
|
!!! error TS2322: Type 'U' is not assignable to type 'Date'.
|
|
d = v; // ok
|
|
}
|
|
|
|
// same as foo4 with different type parameter ordering
|
|
function foo5<V extends Date, U extends V, T extends U>(t: T, u: U, v: V) {
|
|
~~~~~~~~~~~
|
|
!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
~~~~~~~~~~~
|
|
!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
t = u; // error
|
|
~
|
|
!!! error TS2322: Type 'U' is not assignable to type 'T'.
|
|
t = v; // error
|
|
~
|
|
!!! error TS2322: Type 'V' is not assignable to type 'T'.
|
|
t = new Date(); // error
|
|
~
|
|
!!! error TS2322: Type 'Date' is not assignable to type 'T'.
|
|
|
|
u = t;
|
|
~
|
|
!!! error TS2322: Type 'T' is not assignable to type 'U'.
|
|
u = v; // error
|
|
~
|
|
!!! error TS2322: Type 'V' is not assignable to type 'U'.
|
|
u = new Date(); // error
|
|
~
|
|
!!! error TS2322: Type 'Date' is not assignable to type 'U'.
|
|
|
|
v = t;
|
|
~
|
|
!!! error TS2322: Type 'T' is not assignable to type 'V'.
|
|
v = u;
|
|
~
|
|
!!! error TS2322: Type 'U' is not assignable to type 'V'.
|
|
v = new Date(); // ok
|
|
~
|
|
!!! error TS2322: Type 'Date' is not assignable to type 'V'.
|
|
|
|
var d: Date;
|
|
d = t; // ok
|
|
~
|
|
!!! error TS2322: Type 'T' is not assignable to type 'Date'.
|
|
d = u; // ok
|
|
~
|
|
!!! error TS2322: Type 'U' is not assignable to type 'Date'.
|
|
d = v; // ok
|
|
}
|
|
|
|
function foo6<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.
|
|
t = u; // error
|
|
~
|
|
!!! error TS2322: Type 'U' is not assignable to type 'T'.
|
|
t = v; // error
|
|
~
|
|
!!! error TS2322: Type 'V' is not assignable to type 'T'.
|
|
|
|
u = t; // ok
|
|
~
|
|
!!! error TS2322: Type 'T' is not assignable to type 'U'.
|
|
u = v; // error
|
|
~
|
|
!!! error TS2322: Type 'V' is not assignable to type 'U'.
|
|
|
|
v = t; // error
|
|
~
|
|
!!! error TS2322: Type 'T' is not assignable to type 'V'.
|
|
v = u; // error
|
|
~
|
|
!!! error TS2322: Type 'U' is not assignable to type 'V'.
|
|
} |