19 lines
841 B
Plaintext
19 lines
841 B
Plaintext
tests/cases/conformance/types/typeRelationships/recursiveTypes/recursiveTypeInGenericConstraint.ts(5,11): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
|
|
|
|
==== 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
|
|
~~~~~~~~~~~~~~
|
|
!!! error TS2313: 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 |