18 lines
No EOL
1.2 KiB
Text
18 lines
No EOL
1.2 KiB
Text
tests/cases/compiler/constraintsThatReferenceOtherContstraints1.ts(3,14): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
tests/cases/compiler/constraintsThatReferenceOtherContstraints1.ts(4,29): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
|
|
|
|
==== tests/cases/compiler/constraintsThatReferenceOtherContstraints1.ts (2 errors) ====
|
|
interface Object { }
|
|
|
|
class Foo<T, U extends T> { }
|
|
~~~~~~~~~~~
|
|
!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
class Bar<T extends Object, U extends T> {
|
|
~~~~~~~~~~~
|
|
!!! error TS2313: 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
|
|
|