14 lines
790 B
Text
14 lines
790 B
Text
|
==== tests/cases/compiler/constraintsThatReferenceOtherContstraints1.ts (2 errors) ====
|
||
|
interface Object { }
|
||
|
|
||
|
class Foo<T, U extends T> { }
|
||
|
~~~~~~~~~~~
|
||
|
!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
||
|
class Bar<T extends Object, U extends T> {
|
||
|
~~~~~~~~~~~
|
||
|
!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
||
|
data: Foo<Object, Object>; // Error 1 Type 'Object' does not satisfy the constraint 'T' for type parameter 'U extends T'.
|
||
|
}
|
||
|
|
||
|
var x: Foo< { a: string }, { a: string; b: number }>; // Error 2 Type '{ a: string; b: number; }' does not satisfy the constraint 'T' for type
|
||
|
|