1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
=== tests/cases/compiler/constraintsThatReferenceOtherContstraints1.ts ===
interface Object { }
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(constraintsThatReferenceOtherContstraints1.ts, 0, 0))
class Foo<T, U extends T> { }
>Foo : Symbol(Foo, Decl(constraintsThatReferenceOtherContstraints1.ts, 0, 20))
>T : Symbol(T, Decl(constraintsThatReferenceOtherContstraints1.ts, 2, 10))
>U : Symbol(U, Decl(constraintsThatReferenceOtherContstraints1.ts, 2, 12))
>T : Symbol(T, Decl(constraintsThatReferenceOtherContstraints1.ts, 2, 10))
class Bar<T extends Object, U extends T> {
>Bar : Symbol(Bar, Decl(constraintsThatReferenceOtherContstraints1.ts, 2, 29))
>T : Symbol(T, Decl(constraintsThatReferenceOtherContstraints1.ts, 3, 10))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(constraintsThatReferenceOtherContstraints1.ts, 0, 0))
>U : Symbol(U, Decl(constraintsThatReferenceOtherContstraints1.ts, 3, 27))
>T : Symbol(T, Decl(constraintsThatReferenceOtherContstraints1.ts, 3, 10))
data: Foo<Object, Object>; // Error 1 Type 'Object' does not satisfy the constraint 'T' for type parameter 'U extends T'.
>data : Symbol(Bar.data, Decl(constraintsThatReferenceOtherContstraints1.ts, 3, 42))
>Foo : Symbol(Foo, Decl(constraintsThatReferenceOtherContstraints1.ts, 0, 20))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(constraintsThatReferenceOtherContstraints1.ts, 0, 0))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(constraintsThatReferenceOtherContstraints1.ts, 0, 0))
}
var x: Foo< { a: string }, { a: string; b: number }>; // Error 2 Type '{ a: string; b: number; }' does not satisfy the constraint 'T' for type
>x : Symbol(x, Decl(constraintsThatReferenceOtherContstraints1.ts, 7, 3))
>Foo : Symbol(Foo, Decl(constraintsThatReferenceOtherContstraints1.ts, 0, 20))
>a : Symbol(a, Decl(constraintsThatReferenceOtherContstraints1.ts, 7, 13))
>a : Symbol(a, Decl(constraintsThatReferenceOtherContstraints1.ts, 7, 28))
>b : Symbol(b, Decl(constraintsThatReferenceOtherContstraints1.ts, 7, 39))
|