18 lines
681 B
Text
18 lines
681 B
Text
|
==== tests/cases/compiler/typeParameterOrderReversal.ts (2 errors) ====
|
||
|
interface X<T> {
|
||
|
n: T;
|
||
|
}
|
||
|
|
||
|
// Only difference here is order of type parameters
|
||
|
function uFirst<U extends X<T>, T>(x: U) { }
|
||
|
~~~~~~~~~~~~~~
|
||
|
!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
||
|
function tFirst<T, U extends X<T>>(x: U) { }
|
||
|
~~~~~~~~~~~~~~
|
||
|
!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
||
|
var z: X<number> = null;
|
||
|
|
||
|
// Both of these should be allowed
|
||
|
uFirst(z);
|
||
|
tFirst(z);
|
||
|
|