236 lines
3.7 KiB
Text
236 lines
3.7 KiB
Text
=== tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexingResults.ts ===
|
|
class C {
|
|
>C : C
|
|
|
|
[x: number]: string;
|
|
>x : number
|
|
|
|
1 = '';
|
|
>'' : string
|
|
|
|
"2" = ''
|
|
>'' : string
|
|
}
|
|
|
|
var c: C;
|
|
>c : C
|
|
>C : C
|
|
|
|
var r1 = c['1'];
|
|
>r1 : string
|
|
>c['1'] : string
|
|
>c : C
|
|
>'1' : string
|
|
|
|
var r2 = c['2'];
|
|
>r2 : string
|
|
>c['2'] : string
|
|
>c : C
|
|
>'2' : string
|
|
|
|
var r3 = c['3'];
|
|
>r3 : any
|
|
>c['3'] : any
|
|
>c : C
|
|
>'3' : string
|
|
|
|
var r4 = c[1];
|
|
>r4 : string
|
|
>c[1] : string
|
|
>c : C
|
|
>1 : number
|
|
|
|
var r5 = c[2];
|
|
>r5 : string
|
|
>c[2] : string
|
|
>c : C
|
|
>2 : number
|
|
|
|
var r6 = c[3];
|
|
>r6 : string
|
|
>c[3] : string
|
|
>c : C
|
|
>3 : number
|
|
|
|
interface I {
|
|
>I : I
|
|
|
|
[x: number]: string;
|
|
>x : number
|
|
|
|
1: string;
|
|
"2": string;
|
|
}
|
|
|
|
var i: I
|
|
>i : I
|
|
>I : I
|
|
|
|
var r1 = i['1'];
|
|
>r1 : string
|
|
>i['1'] : string
|
|
>i : I
|
|
>'1' : string
|
|
|
|
var r2 = i['2'];
|
|
>r2 : string
|
|
>i['2'] : string
|
|
>i : I
|
|
>'2' : string
|
|
|
|
var r3 = i['3'];
|
|
>r3 : any
|
|
>i['3'] : any
|
|
>i : I
|
|
>'3' : string
|
|
|
|
var r4 = i[1];
|
|
>r4 : string
|
|
>i[1] : string
|
|
>i : I
|
|
>1 : number
|
|
|
|
var r5 = i[2];
|
|
>r5 : string
|
|
>i[2] : string
|
|
>i : I
|
|
>2 : number
|
|
|
|
var r6 = i[3];
|
|
>r6 : string
|
|
>i[3] : string
|
|
>i : I
|
|
>3 : number
|
|
|
|
var a: {
|
|
>a : { [x: number]: string; 1: string; "2": string; }
|
|
|
|
[x: number]: string;
|
|
>x : number
|
|
|
|
1: string;
|
|
"2": string;
|
|
}
|
|
|
|
var r1 = a['1'];
|
|
>r1 : string
|
|
>a['1'] : string
|
|
>a : { [x: number]: string; 1: string; "2": string; }
|
|
>'1' : string
|
|
|
|
var r2 = a['2'];
|
|
>r2 : string
|
|
>a['2'] : string
|
|
>a : { [x: number]: string; 1: string; "2": string; }
|
|
>'2' : string
|
|
|
|
var r3 = a['3'];
|
|
>r3 : any
|
|
>a['3'] : any
|
|
>a : { [x: number]: string; 1: string; "2": string; }
|
|
>'3' : string
|
|
|
|
var r4 = a[1];
|
|
>r4 : string
|
|
>a[1] : string
|
|
>a : { [x: number]: string; 1: string; "2": string; }
|
|
>1 : number
|
|
|
|
var r5 = a[2];
|
|
>r5 : string
|
|
>a[2] : string
|
|
>a : { [x: number]: string; 1: string; "2": string; }
|
|
>2 : number
|
|
|
|
var r6 = a[3];
|
|
>r6 : string
|
|
>a[3] : string
|
|
>a : { [x: number]: string; 1: string; "2": string; }
|
|
>3 : number
|
|
|
|
var b: { [x: number]: string } = { 1: '', "2": '' }
|
|
>b : { [x: number]: string; }
|
|
>x : number
|
|
>{ 1: '', "2": '' } : { [x: number]: string; 1: string; "2": string; }
|
|
>'' : string
|
|
>'' : string
|
|
|
|
var r1a = b['1'];
|
|
>r1a : any
|
|
>b['1'] : any
|
|
>b : { [x: number]: string; }
|
|
>'1' : string
|
|
|
|
var r2a = b['2'];
|
|
>r2a : any
|
|
>b['2'] : any
|
|
>b : { [x: number]: string; }
|
|
>'2' : string
|
|
|
|
var r3 = b['3'];
|
|
>r3 : any
|
|
>b['3'] : any
|
|
>b : { [x: number]: string; }
|
|
>'3' : string
|
|
|
|
var r4 = b[1];
|
|
>r4 : string
|
|
>b[1] : string
|
|
>b : { [x: number]: string; }
|
|
>1 : number
|
|
|
|
var r5 = b[2];
|
|
>r5 : string
|
|
>b[2] : string
|
|
>b : { [x: number]: string; }
|
|
>2 : number
|
|
|
|
var r6 = b[3];
|
|
>r6 : string
|
|
>b[3] : string
|
|
>b : { [x: number]: string; }
|
|
>3 : number
|
|
|
|
var b2: { [x: number]: string; 1: string; "2": string; } = { 1: '', "2": '' }
|
|
>b2 : { [x: number]: string; 1: string; "2": string; }
|
|
>x : number
|
|
>{ 1: '', "2": '' } : { [x: number]: string; 1: string; "2": string; }
|
|
>'' : string
|
|
>'' : string
|
|
|
|
var r1b = b2['1'];
|
|
>r1b : string
|
|
>b2['1'] : string
|
|
>b2 : { [x: number]: string; 1: string; "2": string; }
|
|
>'1' : string
|
|
|
|
var r2b = b2['2'];
|
|
>r2b : string
|
|
>b2['2'] : string
|
|
>b2 : { [x: number]: string; 1: string; "2": string; }
|
|
>'2' : string
|
|
|
|
var r3 = b2['3'];
|
|
>r3 : any
|
|
>b2['3'] : any
|
|
>b2 : { [x: number]: string; 1: string; "2": string; }
|
|
>'3' : string
|
|
|
|
var r4 = b2[1];
|
|
>r4 : string
|
|
>b2[1] : string
|
|
>b2 : { [x: number]: string; 1: string; "2": string; }
|
|
>1 : number
|
|
|
|
var r5 = b2[2];
|
|
>r5 : string
|
|
>b2[2] : string
|
|
>b2 : { [x: number]: string; 1: string; "2": string; }
|
|
>2 : number
|
|
|
|
var r6 = b2[3];
|
|
>r6 : string
|
|
>b2[3] : string
|
|
>b2 : { [x: number]: string; 1: string; "2": string; }
|
|
>3 : number
|
|
|