94 lines
4.8 KiB
Plaintext
94 lines
4.8 KiB
Plaintext
=== 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, 92, 1), Decl(lib.d.ts, 223, 11))
|
|
>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, 92, 1), Decl(lib.d.ts, 223, 11))
|
|
|
|
constructor(public x: T) { }
|
|
>x : Symbol(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, 92, 1), Decl(lib.d.ts, 223, 11))
|
|
|
|
x: T;
|
|
>x : Symbol(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(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(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))
|
|
|
|
|