• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1interface Red {
2	[n:number]; // ok
3	[s:string]; // ok
4}
5
6interface Blue {
7	[n:number]: any; // ok
8	[s:string]: any; // ok
9}
10
11interface Yellow {
12	[n:number]: Red; // ok
13	[s:string]: Red; // ok
14}
15
16interface Orange {
17	[n:number]: number; // ok
18	[s:string]: string; // error
19}
20
21interface Green {
22	[n:number]: Orange; // error
23	[s:string]: Yellow; // ok
24}
25
26interface Cyan {
27	[n:number]: number; // error
28	[s:string]: string; // ok
29}
30
31interface Purple {
32	[n:number, s:string]; // error
33}
34
35interface Magenta {
36	[p:Purple]; // error
37}
38
39var yellow: Yellow;
40var blue: Blue;
41var s = "some string";
42
43yellow[5]; // ok
44yellow["hue"]; // ok
45yellow[<any>{}]; // ok
46
47s[0]; // error
48s["s"]; // ok
49s[<any>{}]; // ok
50
51yellow[blue]; // error
52
53var x:number[];
54x[0];
55
56class Benchmark {
57
58    public results: { [x:string]: any; } = <{ [x:string]: any; }>{};
59
60    public addTimingFor(name: string, timing: number) {
61        this.results[name] = this.results[name];
62    }
63}