title: TypeScript TS7015: Element implicitly has an 'any' type because index expression is not of type 'number'
body: <p>Im getting this compilation error in my Angular 2 app:</p>
  <blockquote>
  <p>TS7015: Element implicitly has an 'any' type because index expression is not of type 'number'.</p>
  </blockquote>
  <p>The piece of code causing it is:</p>
  <pre><code>getApplicationCount(state:string) {
      return this.applicationsByState[state] ? this.applicationsByState[state].length : 0;
    }
  </code></pre>
  <p>This however doesn't cause this error:</p>
  <pre><code>getApplicationCount(state:string) {
      return this.applicationsByState[&lt;any&gt;state] ? this.applicationsByState[&lt;any&gt;state].length : 0;
    }
  </code></pre>
  <p>This doesn't make any sense to me. I would like to solve it when defining the attributes the first time. At the moment I'm writing:</p>
  <pre><code>private applicationsByState: Array&lt;any&gt; = [];
  </code></pre>
  <p>But someone mentioned that the problem is trying to use a string type as index in an array and that I should use a map. But I'm not sure how to do that.</p>
  <p>Thans for your help!</p>