title: TypeScript TS7015 error when accessing an enum using a string type parameter
body: <p>I am new to TypeScript and I don't understand what I need to do to fix the line that generates the TS7015 error (referencing an enum member using a string variable) because the line immediately following that does not error (referencing an enum member using a string literal):</p>
  <pre><code>enum State {
      Happy = 0,
      Sad = 1,
      Drunk = 2
  }
  
  function Emote(enumKey:string) {
      console.log(State[enumKey]); // error TS7015: Element implicitly has an 'any' type because index expression is not of type 'number'.
      console.log(State[&quot;Happy&quot;]); // no error
  }
  </code></pre>
  <p><code>&quot;noImplicitAny&quot;: true</code> is set in the project's <code>tsconfig.json</code> the error is detected</p>
  <p><code>&quot;noImplictAny&quot;: false</code> is set in the project's <code>tsconfig.json</code> no error is detected</p>
  <p><strike>I'm compiling with <code>&quot;ntypescript&quot;: &quot;^1.201603060104.1&quot;</code></strike></p>
  <p>I'm now compiling with <code>&quot;tsc&quot;: &quot;1.8.10&quot;</code></p>
  <pre><code>C:&gt;npm install -g typescript
  
  `-- typescript@1.8.10
  </code></pre>
  <p>Verifying installation:</p>
  <pre><code>C:\&gt;tsc --version
  
  Version 1.8.10
  </code></pre>
  <p>Here's my <code>tsconfig.json</code> file:</p>
  <pre><code>{
    &quot;compileOnSave&quot;: true,
    &quot;compilerOptions&quot;: {
      &quot;target&quot;: &quot;ES5&quot;,
      &quot;module&quot;: &quot;System&quot;,
      &quot;moduleResolution&quot;: &quot;node&quot;,
      &quot;emitDecoratorMetadata&quot;: true,
      &quot;experimentalDecorators&quot;: true,
      &quot;removeComments&quot;: true,
      &quot;noImplicitAny&quot;: true,
      &quot;sourceMap&quot;: true,
      &quot;mapRoot&quot;: &quot;map/&quot;,
      &quot;diagnostics&quot;: true
    },
    &quot;exclude&quot;: [
      &quot;node_modules&quot;,
      &quot;typings&quot;
    ]
  }
  </code></pre>
  <p>Here's the compiler output:</p>
  <pre><code>C:\&gt;tsc
  
  test.ts(8,17): error TS7015: Element implicitly has an 'any' type because index expression is not of type 'number'.
  </code></pre>