title: Initialize array interface
body: <p>As said in the <a href="http://www.typescriptlang.org/docs/handbook/interfaces.html#array-types" rel="nofollow">Handbook</a>, you can declare a custom array interface with string or number index:</p>
  
  <pre><code>interface StringArray {
      [index: number]: string;
  }
  </code></pre>
  
  <p>So I made this:</p>
  
  <pre><code>interface EventRegistrations {
      [index:string]:ListenerEntry[];
  }
  </code></pre>
  
  <p>problem is simple: how can I initialize such a thing?</p>
  
  <p>Here is what I tried and the error message provided (using PhpStorm 2016.1 with tsc 1.8.7):</p>
  
  <pre><code>foo:EventRegistrations = []; 
  </code></pre>
  
  <blockquote>
    <p>Type 'undefined[]' is not assignable to type 'EventRegistrations'</p>
  </blockquote>
  
  <pre><code>foo:EventRegistrations = [[]]; 
  </code></pre>
  
  <blockquote>
    <p>Type 'undefined[][]' is not assignable to type 'EventRegistrations'</p>
  </blockquote>
  
  <pre><code>foo:EventRegistrations = [index:string]:ListenerEntry[]; 
  </code></pre>
  
  <blockquote>
    <p>Syntax error (expected , where first : is)</p>
  </blockquote>
  
  <pre><code>foo:EventRegistrations = [string]:ListenerEntry[];
  </code></pre>
  
  <blockquote>
    <p>Syntax error (expected ; where : is)</p>
  </blockquote>
  
  <pre><code>foo:EventRegistrations = new EventRegistrations();
  </code></pre>
  
  <blockquote>
    <p>Syntax error (cannot find name 'EventRegistrations')</p>
  </blockquote>