16 lines
600 B
Plaintext
16 lines
600 B
Plaintext
|
==== tests/cases/conformance/types/typeRelationships/recursiveTypes/recursiveTypeInGenericConstraint.ts (1 errors) ====
|
||
|
class G<T> {
|
||
|
x: G<G<T>>; // infinitely expanding type reference
|
||
|
}
|
||
|
|
||
|
class Foo<T extends G<T>> { // error, constraint referencing itself
|
||
|
~~~~~~~~~~~~~~
|
||
|
!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
||
|
bar: T;
|
||
|
}
|
||
|
|
||
|
class D<T> {
|
||
|
x: G<G<T>>;
|
||
|
}
|
||
|
|
||
|
var c1 = new Foo<D<string>>(); // ok, circularity in assignment compat check causes success
|