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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
|
=== tests/cases/conformance/types/typeParameters/typeArgumentLists/constraintSatisfactionWithEmptyObject.ts ===
// valid uses of a basic object constraint, no errors expected
// Object constraint
function foo<T extends Object>(x: T) { }
>foo : Symbol(foo, Decl(constraintSatisfactionWithEmptyObject.ts, 0, 0))
>T : Symbol(T, Decl(constraintSatisfactionWithEmptyObject.ts, 3, 13))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>x : Symbol(x, Decl(constraintSatisfactionWithEmptyObject.ts, 3, 31))
>T : Symbol(T, Decl(constraintSatisfactionWithEmptyObject.ts, 3, 13))
var r = foo({});
>r : Symbol(r, Decl(constraintSatisfactionWithEmptyObject.ts, 4, 3), Decl(constraintSatisfactionWithEmptyObject.ts, 6, 3), Decl(constraintSatisfactionWithEmptyObject.ts, 21, 3), Decl(constraintSatisfactionWithEmptyObject.ts, 23, 3))
>foo : Symbol(foo, Decl(constraintSatisfactionWithEmptyObject.ts, 0, 0))
var a = {};
>a : Symbol(a, Decl(constraintSatisfactionWithEmptyObject.ts, 5, 3), Decl(constraintSatisfactionWithEmptyObject.ts, 22, 3))
var r = foo({});
>r : Symbol(r, Decl(constraintSatisfactionWithEmptyObject.ts, 4, 3), Decl(constraintSatisfactionWithEmptyObject.ts, 6, 3), Decl(constraintSatisfactionWithEmptyObject.ts, 21, 3), Decl(constraintSatisfactionWithEmptyObject.ts, 23, 3))
>foo : Symbol(foo, Decl(constraintSatisfactionWithEmptyObject.ts, 0, 0))
class C<T extends Object> {
>C : Symbol(C, Decl(constraintSatisfactionWithEmptyObject.ts, 6, 16))
>T : Symbol(T, Decl(constraintSatisfactionWithEmptyObject.ts, 8, 8))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
constructor(public x: T) { }
>x : Symbol(C.x, Decl(constraintSatisfactionWithEmptyObject.ts, 9, 16))
>T : Symbol(T, Decl(constraintSatisfactionWithEmptyObject.ts, 8, 8))
}
var r2 = new C({});
>r2 : Symbol(r2, Decl(constraintSatisfactionWithEmptyObject.ts, 12, 3), Decl(constraintSatisfactionWithEmptyObject.ts, 29, 3))
>C : Symbol(C, Decl(constraintSatisfactionWithEmptyObject.ts, 6, 16))
interface I<T extends Object> {
>I : Symbol(I, Decl(constraintSatisfactionWithEmptyObject.ts, 12, 19))
>T : Symbol(T, Decl(constraintSatisfactionWithEmptyObject.ts, 14, 12))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
x: T;
>x : Symbol(I.x, Decl(constraintSatisfactionWithEmptyObject.ts, 14, 31))
>T : Symbol(T, Decl(constraintSatisfactionWithEmptyObject.ts, 14, 12))
}
var i: I<{}>;
>i : Symbol(i, Decl(constraintSatisfactionWithEmptyObject.ts, 17, 3))
>I : Symbol(I, Decl(constraintSatisfactionWithEmptyObject.ts, 12, 19))
// {} constraint
function foo2<T extends {}>(x: T) { }
>foo2 : Symbol(foo2, Decl(constraintSatisfactionWithEmptyObject.ts, 17, 13))
>T : Symbol(T, Decl(constraintSatisfactionWithEmptyObject.ts, 20, 14))
>x : Symbol(x, Decl(constraintSatisfactionWithEmptyObject.ts, 20, 28))
>T : Symbol(T, Decl(constraintSatisfactionWithEmptyObject.ts, 20, 14))
var r = foo2({});
>r : Symbol(r, Decl(constraintSatisfactionWithEmptyObject.ts, 4, 3), Decl(constraintSatisfactionWithEmptyObject.ts, 6, 3), Decl(constraintSatisfactionWithEmptyObject.ts, 21, 3), Decl(constraintSatisfactionWithEmptyObject.ts, 23, 3))
>foo2 : Symbol(foo2, Decl(constraintSatisfactionWithEmptyObject.ts, 17, 13))
var a = {};
>a : Symbol(a, Decl(constraintSatisfactionWithEmptyObject.ts, 5, 3), Decl(constraintSatisfactionWithEmptyObject.ts, 22, 3))
var r = foo2({});
>r : Symbol(r, Decl(constraintSatisfactionWithEmptyObject.ts, 4, 3), Decl(constraintSatisfactionWithEmptyObject.ts, 6, 3), Decl(constraintSatisfactionWithEmptyObject.ts, 21, 3), Decl(constraintSatisfactionWithEmptyObject.ts, 23, 3))
>foo2 : Symbol(foo2, Decl(constraintSatisfactionWithEmptyObject.ts, 17, 13))
class C2<T extends {}> {
>C2 : Symbol(C2, Decl(constraintSatisfactionWithEmptyObject.ts, 23, 17))
>T : Symbol(T, Decl(constraintSatisfactionWithEmptyObject.ts, 25, 9))
constructor(public x: T) { }
>x : Symbol(C2.x, Decl(constraintSatisfactionWithEmptyObject.ts, 26, 16))
>T : Symbol(T, Decl(constraintSatisfactionWithEmptyObject.ts, 25, 9))
}
var r2 = new C2({});
>r2 : Symbol(r2, Decl(constraintSatisfactionWithEmptyObject.ts, 12, 3), Decl(constraintSatisfactionWithEmptyObject.ts, 29, 3))
>C2 : Symbol(C2, Decl(constraintSatisfactionWithEmptyObject.ts, 23, 17))
interface I2<T extends {}> {
>I2 : Symbol(I2, Decl(constraintSatisfactionWithEmptyObject.ts, 29, 20))
>T : Symbol(T, Decl(constraintSatisfactionWithEmptyObject.ts, 31, 13))
x: T;
>x : Symbol(I2.x, Decl(constraintSatisfactionWithEmptyObject.ts, 31, 28))
>T : Symbol(T, Decl(constraintSatisfactionWithEmptyObject.ts, 31, 13))
}
var i2: I2<{}>;
>i2 : Symbol(i2, Decl(constraintSatisfactionWithEmptyObject.ts, 34, 3))
>I2 : Symbol(I2, Decl(constraintSatisfactionWithEmptyObject.ts, 29, 20))
|