167 lines
9.9 KiB
Text
167 lines
9.9 KiB
Text
=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithOptionality.ts ===
|
|
// object types are identical structurally
|
|
|
|
class A {
|
|
>A : Symbol(A, Decl(objectTypesIdentityWithOptionality.ts, 0, 0))
|
|
|
|
foo: string;
|
|
>foo : Symbol(foo, Decl(objectTypesIdentityWithOptionality.ts, 2, 9))
|
|
}
|
|
|
|
class B {
|
|
>B : Symbol(B, Decl(objectTypesIdentityWithOptionality.ts, 4, 1))
|
|
|
|
foo: string;
|
|
>foo : Symbol(foo, Decl(objectTypesIdentityWithOptionality.ts, 6, 9))
|
|
}
|
|
|
|
class C<T> {
|
|
>C : Symbol(C, Decl(objectTypesIdentityWithOptionality.ts, 8, 1))
|
|
>T : Symbol(T, Decl(objectTypesIdentityWithOptionality.ts, 10, 8))
|
|
|
|
foo: T;
|
|
>foo : Symbol(foo, Decl(objectTypesIdentityWithOptionality.ts, 10, 12))
|
|
>T : Symbol(T, Decl(objectTypesIdentityWithOptionality.ts, 10, 8))
|
|
}
|
|
|
|
interface I {
|
|
>I : Symbol(I, Decl(objectTypesIdentityWithOptionality.ts, 12, 1))
|
|
|
|
foo?: string;
|
|
>foo : Symbol(foo, Decl(objectTypesIdentityWithOptionality.ts, 14, 13))
|
|
}
|
|
|
|
var a: { foo?: string; }
|
|
>a : Symbol(a, Decl(objectTypesIdentityWithOptionality.ts, 18, 3))
|
|
>foo : Symbol(foo, Decl(objectTypesIdentityWithOptionality.ts, 18, 8))
|
|
|
|
var b = { foo: '' };
|
|
>b : Symbol(b, Decl(objectTypesIdentityWithOptionality.ts, 19, 3))
|
|
>foo : Symbol(foo, Decl(objectTypesIdentityWithOptionality.ts, 19, 9))
|
|
|
|
function foo2(x: I);
|
|
>foo2 : Symbol(foo2, Decl(objectTypesIdentityWithOptionality.ts, 19, 20), Decl(objectTypesIdentityWithOptionality.ts, 21, 20), Decl(objectTypesIdentityWithOptionality.ts, 22, 20))
|
|
>x : Symbol(x, Decl(objectTypesIdentityWithOptionality.ts, 21, 14))
|
|
>I : Symbol(I, Decl(objectTypesIdentityWithOptionality.ts, 12, 1))
|
|
|
|
function foo2(x: I); // error
|
|
>foo2 : Symbol(foo2, Decl(objectTypesIdentityWithOptionality.ts, 19, 20), Decl(objectTypesIdentityWithOptionality.ts, 21, 20), Decl(objectTypesIdentityWithOptionality.ts, 22, 20))
|
|
>x : Symbol(x, Decl(objectTypesIdentityWithOptionality.ts, 22, 14))
|
|
>I : Symbol(I, Decl(objectTypesIdentityWithOptionality.ts, 12, 1))
|
|
|
|
function foo2(x: any) { }
|
|
>foo2 : Symbol(foo2, Decl(objectTypesIdentityWithOptionality.ts, 19, 20), Decl(objectTypesIdentityWithOptionality.ts, 21, 20), Decl(objectTypesIdentityWithOptionality.ts, 22, 20))
|
|
>x : Symbol(x, Decl(objectTypesIdentityWithOptionality.ts, 23, 14))
|
|
|
|
function foo3(x: typeof a);
|
|
>foo3 : Symbol(foo3, Decl(objectTypesIdentityWithOptionality.ts, 23, 25), Decl(objectTypesIdentityWithOptionality.ts, 25, 27), Decl(objectTypesIdentityWithOptionality.ts, 26, 27))
|
|
>x : Symbol(x, Decl(objectTypesIdentityWithOptionality.ts, 25, 14))
|
|
>a : Symbol(a, Decl(objectTypesIdentityWithOptionality.ts, 18, 3))
|
|
|
|
function foo3(x: typeof a); // error
|
|
>foo3 : Symbol(foo3, Decl(objectTypesIdentityWithOptionality.ts, 23, 25), Decl(objectTypesIdentityWithOptionality.ts, 25, 27), Decl(objectTypesIdentityWithOptionality.ts, 26, 27))
|
|
>x : Symbol(x, Decl(objectTypesIdentityWithOptionality.ts, 26, 14))
|
|
>a : Symbol(a, Decl(objectTypesIdentityWithOptionality.ts, 18, 3))
|
|
|
|
function foo3(x: any) { }
|
|
>foo3 : Symbol(foo3, Decl(objectTypesIdentityWithOptionality.ts, 23, 25), Decl(objectTypesIdentityWithOptionality.ts, 25, 27), Decl(objectTypesIdentityWithOptionality.ts, 26, 27))
|
|
>x : Symbol(x, Decl(objectTypesIdentityWithOptionality.ts, 27, 14))
|
|
|
|
function foo6(x: A);
|
|
>foo6 : Symbol(foo6, Decl(objectTypesIdentityWithOptionality.ts, 27, 25), Decl(objectTypesIdentityWithOptionality.ts, 29, 20), Decl(objectTypesIdentityWithOptionality.ts, 30, 20))
|
|
>x : Symbol(x, Decl(objectTypesIdentityWithOptionality.ts, 29, 14))
|
|
>A : Symbol(A, Decl(objectTypesIdentityWithOptionality.ts, 0, 0))
|
|
|
|
function foo6(x: I); // ok
|
|
>foo6 : Symbol(foo6, Decl(objectTypesIdentityWithOptionality.ts, 27, 25), Decl(objectTypesIdentityWithOptionality.ts, 29, 20), Decl(objectTypesIdentityWithOptionality.ts, 30, 20))
|
|
>x : Symbol(x, Decl(objectTypesIdentityWithOptionality.ts, 30, 14))
|
|
>I : Symbol(I, Decl(objectTypesIdentityWithOptionality.ts, 12, 1))
|
|
|
|
function foo6(x: any) { }
|
|
>foo6 : Symbol(foo6, Decl(objectTypesIdentityWithOptionality.ts, 27, 25), Decl(objectTypesIdentityWithOptionality.ts, 29, 20), Decl(objectTypesIdentityWithOptionality.ts, 30, 20))
|
|
>x : Symbol(x, Decl(objectTypesIdentityWithOptionality.ts, 31, 14))
|
|
|
|
function foo7(x: A);
|
|
>foo7 : Symbol(foo7, Decl(objectTypesIdentityWithOptionality.ts, 31, 25), Decl(objectTypesIdentityWithOptionality.ts, 33, 20), Decl(objectTypesIdentityWithOptionality.ts, 34, 27))
|
|
>x : Symbol(x, Decl(objectTypesIdentityWithOptionality.ts, 33, 14))
|
|
>A : Symbol(A, Decl(objectTypesIdentityWithOptionality.ts, 0, 0))
|
|
|
|
function foo7(x: typeof a); // ok
|
|
>foo7 : Symbol(foo7, Decl(objectTypesIdentityWithOptionality.ts, 31, 25), Decl(objectTypesIdentityWithOptionality.ts, 33, 20), Decl(objectTypesIdentityWithOptionality.ts, 34, 27))
|
|
>x : Symbol(x, Decl(objectTypesIdentityWithOptionality.ts, 34, 14))
|
|
>a : Symbol(a, Decl(objectTypesIdentityWithOptionality.ts, 18, 3))
|
|
|
|
function foo7(x: any) { }
|
|
>foo7 : Symbol(foo7, Decl(objectTypesIdentityWithOptionality.ts, 31, 25), Decl(objectTypesIdentityWithOptionality.ts, 33, 20), Decl(objectTypesIdentityWithOptionality.ts, 34, 27))
|
|
>x : Symbol(x, Decl(objectTypesIdentityWithOptionality.ts, 35, 14))
|
|
|
|
function foo8(x: B);
|
|
>foo8 : Symbol(foo8, Decl(objectTypesIdentityWithOptionality.ts, 35, 25), Decl(objectTypesIdentityWithOptionality.ts, 37, 20), Decl(objectTypesIdentityWithOptionality.ts, 38, 20))
|
|
>x : Symbol(x, Decl(objectTypesIdentityWithOptionality.ts, 37, 14))
|
|
>B : Symbol(B, Decl(objectTypesIdentityWithOptionality.ts, 4, 1))
|
|
|
|
function foo8(x: I); // ok
|
|
>foo8 : Symbol(foo8, Decl(objectTypesIdentityWithOptionality.ts, 35, 25), Decl(objectTypesIdentityWithOptionality.ts, 37, 20), Decl(objectTypesIdentityWithOptionality.ts, 38, 20))
|
|
>x : Symbol(x, Decl(objectTypesIdentityWithOptionality.ts, 38, 14))
|
|
>I : Symbol(I, Decl(objectTypesIdentityWithOptionality.ts, 12, 1))
|
|
|
|
function foo8(x: any) { }
|
|
>foo8 : Symbol(foo8, Decl(objectTypesIdentityWithOptionality.ts, 35, 25), Decl(objectTypesIdentityWithOptionality.ts, 37, 20), Decl(objectTypesIdentityWithOptionality.ts, 38, 20))
|
|
>x : Symbol(x, Decl(objectTypesIdentityWithOptionality.ts, 39, 14))
|
|
|
|
function foo10(x: B);
|
|
>foo10 : Symbol(foo10, Decl(objectTypesIdentityWithOptionality.ts, 39, 25), Decl(objectTypesIdentityWithOptionality.ts, 41, 21), Decl(objectTypesIdentityWithOptionality.ts, 42, 28))
|
|
>x : Symbol(x, Decl(objectTypesIdentityWithOptionality.ts, 41, 15))
|
|
>B : Symbol(B, Decl(objectTypesIdentityWithOptionality.ts, 4, 1))
|
|
|
|
function foo10(x: typeof a); // ok
|
|
>foo10 : Symbol(foo10, Decl(objectTypesIdentityWithOptionality.ts, 39, 25), Decl(objectTypesIdentityWithOptionality.ts, 41, 21), Decl(objectTypesIdentityWithOptionality.ts, 42, 28))
|
|
>x : Symbol(x, Decl(objectTypesIdentityWithOptionality.ts, 42, 15))
|
|
>a : Symbol(a, Decl(objectTypesIdentityWithOptionality.ts, 18, 3))
|
|
|
|
function foo10(x: any) { }
|
|
>foo10 : Symbol(foo10, Decl(objectTypesIdentityWithOptionality.ts, 39, 25), Decl(objectTypesIdentityWithOptionality.ts, 41, 21), Decl(objectTypesIdentityWithOptionality.ts, 42, 28))
|
|
>x : Symbol(x, Decl(objectTypesIdentityWithOptionality.ts, 43, 15))
|
|
|
|
function foo12(x: I);
|
|
>foo12 : Symbol(foo12, Decl(objectTypesIdentityWithOptionality.ts, 43, 26), Decl(objectTypesIdentityWithOptionality.ts, 45, 21), Decl(objectTypesIdentityWithOptionality.ts, 46, 29))
|
|
>x : Symbol(x, Decl(objectTypesIdentityWithOptionality.ts, 45, 15))
|
|
>I : Symbol(I, Decl(objectTypesIdentityWithOptionality.ts, 12, 1))
|
|
|
|
function foo12(x: C<string>); // ok
|
|
>foo12 : Symbol(foo12, Decl(objectTypesIdentityWithOptionality.ts, 43, 26), Decl(objectTypesIdentityWithOptionality.ts, 45, 21), Decl(objectTypesIdentityWithOptionality.ts, 46, 29))
|
|
>x : Symbol(x, Decl(objectTypesIdentityWithOptionality.ts, 46, 15))
|
|
>C : Symbol(C, Decl(objectTypesIdentityWithOptionality.ts, 8, 1))
|
|
|
|
function foo12(x: any) { }
|
|
>foo12 : Symbol(foo12, Decl(objectTypesIdentityWithOptionality.ts, 43, 26), Decl(objectTypesIdentityWithOptionality.ts, 45, 21), Decl(objectTypesIdentityWithOptionality.ts, 46, 29))
|
|
>x : Symbol(x, Decl(objectTypesIdentityWithOptionality.ts, 47, 15))
|
|
|
|
function foo13(x: I);
|
|
>foo13 : Symbol(foo13, Decl(objectTypesIdentityWithOptionality.ts, 47, 26), Decl(objectTypesIdentityWithOptionality.ts, 49, 21), Decl(objectTypesIdentityWithOptionality.ts, 50, 28))
|
|
>x : Symbol(x, Decl(objectTypesIdentityWithOptionality.ts, 49, 15))
|
|
>I : Symbol(I, Decl(objectTypesIdentityWithOptionality.ts, 12, 1))
|
|
|
|
function foo13(x: typeof a); // error
|
|
>foo13 : Symbol(foo13, Decl(objectTypesIdentityWithOptionality.ts, 47, 26), Decl(objectTypesIdentityWithOptionality.ts, 49, 21), Decl(objectTypesIdentityWithOptionality.ts, 50, 28))
|
|
>x : Symbol(x, Decl(objectTypesIdentityWithOptionality.ts, 50, 15))
|
|
>a : Symbol(a, Decl(objectTypesIdentityWithOptionality.ts, 18, 3))
|
|
|
|
function foo13(x: any) { }
|
|
>foo13 : Symbol(foo13, Decl(objectTypesIdentityWithOptionality.ts, 47, 26), Decl(objectTypesIdentityWithOptionality.ts, 49, 21), Decl(objectTypesIdentityWithOptionality.ts, 50, 28))
|
|
>x : Symbol(x, Decl(objectTypesIdentityWithOptionality.ts, 51, 15))
|
|
|
|
function foo14(x: I);
|
|
>foo14 : Symbol(foo14, Decl(objectTypesIdentityWithOptionality.ts, 51, 26), Decl(objectTypesIdentityWithOptionality.ts, 53, 21), Decl(objectTypesIdentityWithOptionality.ts, 54, 28))
|
|
>x : Symbol(x, Decl(objectTypesIdentityWithOptionality.ts, 53, 15))
|
|
>I : Symbol(I, Decl(objectTypesIdentityWithOptionality.ts, 12, 1))
|
|
|
|
function foo14(x: typeof b); // ok
|
|
>foo14 : Symbol(foo14, Decl(objectTypesIdentityWithOptionality.ts, 51, 26), Decl(objectTypesIdentityWithOptionality.ts, 53, 21), Decl(objectTypesIdentityWithOptionality.ts, 54, 28))
|
|
>x : Symbol(x, Decl(objectTypesIdentityWithOptionality.ts, 54, 15))
|
|
>b : Symbol(b, Decl(objectTypesIdentityWithOptionality.ts, 19, 3))
|
|
|
|
function foo14(x: any) { }
|
|
>foo14 : Symbol(foo14, Decl(objectTypesIdentityWithOptionality.ts, 51, 26), Decl(objectTypesIdentityWithOptionality.ts, 53, 21), Decl(objectTypesIdentityWithOptionality.ts, 54, 28))
|
|
>x : Symbol(x, Decl(objectTypesIdentityWithOptionality.ts, 55, 15))
|
|
|