<p dir="auto"><strong>TypeScript Version:</strong><br>
1.8.7</p>
<p dir="auto"><strong>Code</strong></p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="type StringOrNumberKeys: { [key: string | number]: number };"><pre class="notranslate">type <span class="pl-smi">StringOrNumberKeys</span>: <span class="pl-kos">{</span> <span class="pl-kos">[</span><span class="pl-s1">key</span>: <span class="pl-s1">string</span> <span class="pl-c1">|</span> <span class="pl-s1">number</span><span class="pl-kos">]</span>: <span class="pl-s1">number</span> <span class="pl-kos">}</span><span class="pl-kos">;</span></pre></div>
<p dir="auto"><strong>Expected behavior:</strong><br>
Should work</p>
<p dir="auto"><strong>Actual behavior:</strong></p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="Error: an index signature parameter must be 'string' or 'number'"><pre class="notranslate">Error: <span class="pl-s1">an</span> <span class="pl-s1">index</span> <span class="pl-s1">signature</span> <span class="pl-s1">parameter</span> <span class="pl-s1">must</span> <span class="pl-s1">be</span> <span class="pl-s">'string'</span> <span class="pl-s1">or</span> <span class="pl-s">'number'</span></pre></div>
<p dir="auto">This syntax :<br>
var map: { [index: string|number ]: number };</p>
<p dir="auto">results in compiler error :<br>
An index signature parameter type must be 'string' or 'number'.</p>