146 lines
2.3 KiB
Plaintext
146 lines
2.3 KiB
Plaintext
|
=== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersNumericNames.ts ===
|
||
|
// members N and M of types S and T have the same name, same accessibility, same optionality, and N is assignable M
|
||
|
// numeric named properties work correctly, no errors expected
|
||
|
|
||
|
class S { 1: string; }
|
||
|
>S : S
|
||
|
|
||
|
class T { 1.: string; }
|
||
|
>T : T
|
||
|
|
||
|
var s: S;
|
||
|
>s : S
|
||
|
>S : S
|
||
|
|
||
|
var t: T;
|
||
|
>t : T
|
||
|
>T : T
|
||
|
|
||
|
interface S2 { 1: string; bar?: string }
|
||
|
>S2 : S2
|
||
|
>bar : string
|
||
|
|
||
|
interface T2 { 1.0: string; baz?: string }
|
||
|
>T2 : T2
|
||
|
>baz : string
|
||
|
|
||
|
var s2: S2;
|
||
|
>s2 : S2
|
||
|
>S2 : S2
|
||
|
|
||
|
var t2: T2;
|
||
|
>t2 : T2
|
||
|
>T2 : T2
|
||
|
|
||
|
var a: { 1.: string; bar?: string }
|
||
|
>a : { 1.: string; bar?: string; }
|
||
|
>bar : string
|
||
|
|
||
|
var b: { 1.0: string; baz?: string }
|
||
|
>b : { 1.0: string; baz?: string; }
|
||
|
>baz : string
|
||
|
|
||
|
var a2 = { 1.0: '' };
|
||
|
>a2 : { 1.0: string; }
|
||
|
>{ 1.0: '' } : { 1.0: string; }
|
||
|
|
||
|
var b2 = { 1: '' };
|
||
|
>b2 : { 1: string; }
|
||
|
>{ 1: '' } : { 1: string; }
|
||
|
|
||
|
s = t;
|
||
|
>s = t : T
|
||
|
>s : S
|
||
|
>t : T
|
||
|
|
||
|
t = s;
|
||
|
>t = s : S
|
||
|
>t : T
|
||
|
>s : S
|
||
|
|
||
|
s = s2;
|
||
|
>s = s2 : S2
|
||
|
>s : S
|
||
|
>s2 : S2
|
||
|
|
||
|
s = a2;
|
||
|
>s = a2 : { 1.0: string; }
|
||
|
>s : S
|
||
|
>a2 : { 1.0: string; }
|
||
|
|
||
|
s2 = t2;
|
||
|
>s2 = t2 : T2
|
||
|
>s2 : S2
|
||
|
>t2 : T2
|
||
|
|
||
|
t2 = s2;
|
||
|
>t2 = s2 : S2
|
||
|
>t2 : T2
|
||
|
>s2 : S2
|
||
|
|
||
|
s2 = t;
|
||
|
>s2 = t : T
|
||
|
>s2 : S2
|
||
|
>t : T
|
||
|
|
||
|
s2 = b;
|
||
|
>s2 = b : { 1.0: string; baz?: string; }
|
||
|
>s2 : S2
|
||
|
>b : { 1.0: string; baz?: string; }
|
||
|
|
||
|
s2 = a2;
|
||
|
>s2 = a2 : { 1.0: string; }
|
||
|
>s2 : S2
|
||
|
>a2 : { 1.0: string; }
|
||
|
|
||
|
a = b;
|
||
|
>a = b : { 1.0: string; baz?: string; }
|
||
|
>a : { 1.: string; bar?: string; }
|
||
|
>b : { 1.0: string; baz?: string; }
|
||
|
|
||
|
b = a;
|
||
|
>b = a : { 1.: string; bar?: string; }
|
||
|
>b : { 1.0: string; baz?: string; }
|
||
|
>a : { 1.: string; bar?: string; }
|
||
|
|
||
|
a = s;
|
||
|
>a = s : S
|
||
|
>a : { 1.: string; bar?: string; }
|
||
|
>s : S
|
||
|
|
||
|
a = s2;
|
||
|
>a = s2 : S2
|
||
|
>a : { 1.: string; bar?: string; }
|
||
|
>s2 : S2
|
||
|
|
||
|
a = a2;
|
||
|
>a = a2 : { 1.0: string; }
|
||
|
>a : { 1.: string; bar?: string; }
|
||
|
>a2 : { 1.0: string; }
|
||
|
|
||
|
a2 = b2;
|
||
|
>a2 = b2 : { 1: string; }
|
||
|
>a2 : { 1.0: string; }
|
||
|
>b2 : { 1: string; }
|
||
|
|
||
|
b2 = a2;
|
||
|
>b2 = a2 : { 1.0: string; }
|
||
|
>b2 : { 1: string; }
|
||
|
>a2 : { 1.0: string; }
|
||
|
|
||
|
a2 = b;
|
||
|
>a2 = b : { 1.0: string; baz?: string; }
|
||
|
>a2 : { 1.0: string; }
|
||
|
>b : { 1.0: string; baz?: string; }
|
||
|
|
||
|
a2 = t2;
|
||
|
>a2 = t2 : T2
|
||
|
>a2 : { 1.0: string; }
|
||
|
>t2 : T2
|
||
|
|
||
|
a2 = t;
|
||
|
>a2 = t : T
|
||
|
>a2 : { 1.0: string; }
|
||
|
>t : T
|
||
|
|