155 lines
6.4 KiB
Text
155 lines
6.4 KiB
Text
=== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers2.ts ===
|
|
// members N and M of types S and T have the same name, same accessibility, same optionality, and N is assignable M
|
|
// additional optional properties do not cause errors
|
|
|
|
class S { foo: string; }
|
|
>S : S, Symbol(S,Decl(assignmentCompatWithObjectMembers2.ts,0,0))
|
|
>foo : string, Symbol(foo,Decl(assignmentCompatWithObjectMembers2.ts,3,9))
|
|
|
|
class T { foo: string; }
|
|
>T : T, Symbol(T,Decl(assignmentCompatWithObjectMembers2.ts,3,24))
|
|
>foo : string, Symbol(foo,Decl(assignmentCompatWithObjectMembers2.ts,4,9))
|
|
|
|
var s: S;
|
|
>s : S, Symbol(s,Decl(assignmentCompatWithObjectMembers2.ts,5,3))
|
|
>S : S, Symbol(S,Decl(assignmentCompatWithObjectMembers2.ts,0,0))
|
|
|
|
var t: T;
|
|
>t : T, Symbol(t,Decl(assignmentCompatWithObjectMembers2.ts,6,3))
|
|
>T : T, Symbol(T,Decl(assignmentCompatWithObjectMembers2.ts,3,24))
|
|
|
|
interface S2 { foo: string; bar?: string }
|
|
>S2 : S2, Symbol(S2,Decl(assignmentCompatWithObjectMembers2.ts,6,9))
|
|
>foo : string, Symbol(foo,Decl(assignmentCompatWithObjectMembers2.ts,8,14))
|
|
>bar : string, Symbol(bar,Decl(assignmentCompatWithObjectMembers2.ts,8,27))
|
|
|
|
interface T2 { foo: string; baz?: string }
|
|
>T2 : T2, Symbol(T2,Decl(assignmentCompatWithObjectMembers2.ts,8,42))
|
|
>foo : string, Symbol(foo,Decl(assignmentCompatWithObjectMembers2.ts,9,14))
|
|
>baz : string, Symbol(baz,Decl(assignmentCompatWithObjectMembers2.ts,9,27))
|
|
|
|
var s2: S2;
|
|
>s2 : S2, Symbol(s2,Decl(assignmentCompatWithObjectMembers2.ts,10,3))
|
|
>S2 : S2, Symbol(S2,Decl(assignmentCompatWithObjectMembers2.ts,6,9))
|
|
|
|
var t2: T2;
|
|
>t2 : T2, Symbol(t2,Decl(assignmentCompatWithObjectMembers2.ts,11,3))
|
|
>T2 : T2, Symbol(T2,Decl(assignmentCompatWithObjectMembers2.ts,8,42))
|
|
|
|
var a: { foo: string; bar?: string }
|
|
>a : { foo: string; bar?: string; }, Symbol(a,Decl(assignmentCompatWithObjectMembers2.ts,13,3))
|
|
>foo : string, Symbol(foo,Decl(assignmentCompatWithObjectMembers2.ts,13,8))
|
|
>bar : string, Symbol(bar,Decl(assignmentCompatWithObjectMembers2.ts,13,21))
|
|
|
|
var b: { foo: string; baz?: string }
|
|
>b : { foo: string; baz?: string; }, Symbol(b,Decl(assignmentCompatWithObjectMembers2.ts,14,3))
|
|
>foo : string, Symbol(foo,Decl(assignmentCompatWithObjectMembers2.ts,14,8))
|
|
>baz : string, Symbol(baz,Decl(assignmentCompatWithObjectMembers2.ts,14,21))
|
|
|
|
var a2 = { foo: '' };
|
|
>a2 : { foo: string; }, Symbol(a2,Decl(assignmentCompatWithObjectMembers2.ts,16,3))
|
|
>{ foo: '' } : { foo: string; }
|
|
>foo : string, Symbol(foo,Decl(assignmentCompatWithObjectMembers2.ts,16,10))
|
|
>'' : string
|
|
|
|
var b2 = { foo: '' };
|
|
>b2 : { foo: string; }, Symbol(b2,Decl(assignmentCompatWithObjectMembers2.ts,17,3))
|
|
>{ foo: '' } : { foo: string; }
|
|
>foo : string, Symbol(foo,Decl(assignmentCompatWithObjectMembers2.ts,17,10))
|
|
>'' : string
|
|
|
|
s = t;
|
|
>s = t : T
|
|
>s : S, Symbol(s,Decl(assignmentCompatWithObjectMembers2.ts,5,3))
|
|
>t : T, Symbol(t,Decl(assignmentCompatWithObjectMembers2.ts,6,3))
|
|
|
|
t = s;
|
|
>t = s : S
|
|
>t : T, Symbol(t,Decl(assignmentCompatWithObjectMembers2.ts,6,3))
|
|
>s : S, Symbol(s,Decl(assignmentCompatWithObjectMembers2.ts,5,3))
|
|
|
|
s = s2;
|
|
>s = s2 : S2
|
|
>s : S, Symbol(s,Decl(assignmentCompatWithObjectMembers2.ts,5,3))
|
|
>s2 : S2, Symbol(s2,Decl(assignmentCompatWithObjectMembers2.ts,10,3))
|
|
|
|
s = a2;
|
|
>s = a2 : { foo: string; }
|
|
>s : S, Symbol(s,Decl(assignmentCompatWithObjectMembers2.ts,5,3))
|
|
>a2 : { foo: string; }, Symbol(a2,Decl(assignmentCompatWithObjectMembers2.ts,16,3))
|
|
|
|
s2 = t2;
|
|
>s2 = t2 : T2
|
|
>s2 : S2, Symbol(s2,Decl(assignmentCompatWithObjectMembers2.ts,10,3))
|
|
>t2 : T2, Symbol(t2,Decl(assignmentCompatWithObjectMembers2.ts,11,3))
|
|
|
|
t2 = s2;
|
|
>t2 = s2 : S2
|
|
>t2 : T2, Symbol(t2,Decl(assignmentCompatWithObjectMembers2.ts,11,3))
|
|
>s2 : S2, Symbol(s2,Decl(assignmentCompatWithObjectMembers2.ts,10,3))
|
|
|
|
s2 = t;
|
|
>s2 = t : T
|
|
>s2 : S2, Symbol(s2,Decl(assignmentCompatWithObjectMembers2.ts,10,3))
|
|
>t : T, Symbol(t,Decl(assignmentCompatWithObjectMembers2.ts,6,3))
|
|
|
|
s2 = b;
|
|
>s2 = b : { foo: string; baz?: string; }
|
|
>s2 : S2, Symbol(s2,Decl(assignmentCompatWithObjectMembers2.ts,10,3))
|
|
>b : { foo: string; baz?: string; }, Symbol(b,Decl(assignmentCompatWithObjectMembers2.ts,14,3))
|
|
|
|
s2 = a2;
|
|
>s2 = a2 : { foo: string; }
|
|
>s2 : S2, Symbol(s2,Decl(assignmentCompatWithObjectMembers2.ts,10,3))
|
|
>a2 : { foo: string; }, Symbol(a2,Decl(assignmentCompatWithObjectMembers2.ts,16,3))
|
|
|
|
a = b;
|
|
>a = b : { foo: string; baz?: string; }
|
|
>a : { foo: string; bar?: string; }, Symbol(a,Decl(assignmentCompatWithObjectMembers2.ts,13,3))
|
|
>b : { foo: string; baz?: string; }, Symbol(b,Decl(assignmentCompatWithObjectMembers2.ts,14,3))
|
|
|
|
b = a;
|
|
>b = a : { foo: string; bar?: string; }
|
|
>b : { foo: string; baz?: string; }, Symbol(b,Decl(assignmentCompatWithObjectMembers2.ts,14,3))
|
|
>a : { foo: string; bar?: string; }, Symbol(a,Decl(assignmentCompatWithObjectMembers2.ts,13,3))
|
|
|
|
a = s;
|
|
>a = s : S
|
|
>a : { foo: string; bar?: string; }, Symbol(a,Decl(assignmentCompatWithObjectMembers2.ts,13,3))
|
|
>s : S, Symbol(s,Decl(assignmentCompatWithObjectMembers2.ts,5,3))
|
|
|
|
a = s2;
|
|
>a = s2 : S2
|
|
>a : { foo: string; bar?: string; }, Symbol(a,Decl(assignmentCompatWithObjectMembers2.ts,13,3))
|
|
>s2 : S2, Symbol(s2,Decl(assignmentCompatWithObjectMembers2.ts,10,3))
|
|
|
|
a = a2;
|
|
>a = a2 : { foo: string; }
|
|
>a : { foo: string; bar?: string; }, Symbol(a,Decl(assignmentCompatWithObjectMembers2.ts,13,3))
|
|
>a2 : { foo: string; }, Symbol(a2,Decl(assignmentCompatWithObjectMembers2.ts,16,3))
|
|
|
|
a2 = b2;
|
|
>a2 = b2 : { foo: string; }
|
|
>a2 : { foo: string; }, Symbol(a2,Decl(assignmentCompatWithObjectMembers2.ts,16,3))
|
|
>b2 : { foo: string; }, Symbol(b2,Decl(assignmentCompatWithObjectMembers2.ts,17,3))
|
|
|
|
b2 = a2;
|
|
>b2 = a2 : { foo: string; }
|
|
>b2 : { foo: string; }, Symbol(b2,Decl(assignmentCompatWithObjectMembers2.ts,17,3))
|
|
>a2 : { foo: string; }, Symbol(a2,Decl(assignmentCompatWithObjectMembers2.ts,16,3))
|
|
|
|
a2 = b;
|
|
>a2 = b : { foo: string; baz?: string; }
|
|
>a2 : { foo: string; }, Symbol(a2,Decl(assignmentCompatWithObjectMembers2.ts,16,3))
|
|
>b : { foo: string; baz?: string; }, Symbol(b,Decl(assignmentCompatWithObjectMembers2.ts,14,3))
|
|
|
|
a2 = t2;
|
|
>a2 = t2 : T2
|
|
>a2 : { foo: string; }, Symbol(a2,Decl(assignmentCompatWithObjectMembers2.ts,16,3))
|
|
>t2 : T2, Symbol(t2,Decl(assignmentCompatWithObjectMembers2.ts,11,3))
|
|
|
|
a2 = t;
|
|
>a2 = t : T
|
|
>a2 : { foo: string; }, Symbol(a2,Decl(assignmentCompatWithObjectMembers2.ts,16,3))
|
|
>t : T, Symbol(t,Decl(assignmentCompatWithObjectMembers2.ts,6,3))
|
|
|