<p dir="auto"><strong>TypeScript Version:</strong></p>
<p dir="auto">1.8.9</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="new Map&lt;number, number&gt;([1, 2].map(x =&gt; [x, x]));

// Error:
// Argument of type 'number[][]' is not assignable to parameter of type 'Iterable&lt;[number, number]&gt;'…
"><pre class="notranslate"><span class="pl-k">new</span> <span class="pl-smi">Map</span><span class="pl-kos">&lt;</span><span class="pl-smi">number</span><span class="pl-kos">,</span> <span class="pl-smi">number</span><span class="pl-kos">&gt;</span><span class="pl-kos">(</span><span class="pl-kos">[</span><span class="pl-c1">1</span><span class="pl-kos">,</span> <span class="pl-c1">2</span><span class="pl-kos">]</span><span class="pl-kos">.</span><span class="pl-en">map</span><span class="pl-kos">(</span><span class="pl-s1">x</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">[</span><span class="pl-s1">x</span><span class="pl-kos">,</span> <span class="pl-s1">x</span><span class="pl-kos">]</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-c">// Error:</span>
<span class="pl-c">// Argument of type 'number[][]' is not assignable to parameter of type 'Iterable&lt;[number, number]&gt;'…</span></pre></div>
<p dir="auto"><strong>Expected behavior:</strong> types are inferred correctly, no error shown.<br>
<strong>Actual behavior:</strong> type error.</p>
<p dir="auto">I have a piece of code with many <code class="notranslate">foo[]</code>s that should really be <code class="notranslate">[foo,foo]</code> -- it would be nicer if <code class="notranslate">map</code> had a type that preserves tuples, so something like this:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="var x: [number, number];
x = [1,2].map(x=&gt;x+1);"><pre class="notranslate"><code class="notranslate">var x: [number, number];
x = [1,2].map(x=&gt;x+1);
</code></pre></div>
<p dir="auto">would work, even if it's some hack with a union of tuples up to some number of elements (I think that I saw something like that around rest arguments, and I imagine that this in a close neighborhood).</p>
<p dir="auto">I thought that this would be common, but didn't find anything about it.  Feel free to dismiss if it is.</p>