<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="function f0(): [number, number] {
    return [1, 2]; // works
}

interface Some&lt;a&gt; { some: a; }
interface None { none: void; }
type Optional&lt;a&gt; = Some&lt;a&gt; | None;

function f1(): Optional&lt;[number, number]&gt; {
    return { some: [1, 2] }; // works
}

function some&lt;a&gt;(value: a) : Some&lt;a&gt; {
    return { some: value };
}

function f2() : Optional&lt;[number, number]&gt; {
    return some([1, 2]); // doesn't work
}"><pre class="notranslate"><span class="pl-k">function</span> <span class="pl-en">f0</span><span class="pl-kos">(</span><span class="pl-kos">)</span>: <span class="pl-kos">[</span><span class="pl-smi">number</span><span class="pl-kos">,</span> <span class="pl-smi">number</span><span class="pl-kos">]</span> <span class="pl-kos">{</span>
    <span class="pl-k">return</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-c">// works</span>
<span class="pl-kos">}</span>

<span class="pl-k">interface</span> <span class="pl-smi">Some</span><span class="pl-c1">&lt;</span><span class="pl-smi">a</span><span class="pl-c1">&gt;</span> <span class="pl-kos">{</span> <span class="pl-c1">some</span>: <span class="pl-smi">a</span><span class="pl-kos">;</span> <span class="pl-kos">}</span>
<span class="pl-k">interface</span> <span class="pl-smi">None</span> <span class="pl-kos">{</span> <span class="pl-c1">none</span>: <span class="pl-smi"><span class="pl-k">void</span></span><span class="pl-kos">;</span> <span class="pl-kos">}</span>
<span class="pl-k">type</span> <span class="pl-smi">Optional</span><span class="pl-c1">&lt;</span><span class="pl-smi">a</span><span class="pl-c1">&gt;</span> <span class="pl-c1">=</span> <span class="pl-smi">Some</span><span class="pl-kos">&lt;</span><span class="pl-smi">a</span><span class="pl-kos">&gt;</span> <span class="pl-c1">|</span> <span class="pl-smi">None</span><span class="pl-kos">;</span>

<span class="pl-k">function</span> <span class="pl-en">f1</span><span class="pl-kos">(</span><span class="pl-kos">)</span>: <span class="pl-smi">Optional</span><span class="pl-kos">&lt;</span><span class="pl-kos">[</span><span class="pl-smi">number</span><span class="pl-kos">,</span> <span class="pl-smi">number</span><span class="pl-kos">]</span><span class="pl-kos">&gt;</span> <span class="pl-kos">{</span>
    <span class="pl-k">return</span> <span class="pl-kos">{</span> <span class="pl-c1">some</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-kos">;</span> <span class="pl-c">// works</span>
<span class="pl-kos">}</span>

<span class="pl-k">function</span> <span class="pl-en">some</span><span class="pl-c1">&lt;</span><span class="pl-smi">a</span><span class="pl-c1">&gt;</span><span class="pl-kos">(</span><span class="pl-s1">value</span>: <span class="pl-smi">a</span><span class="pl-kos">)</span> : <span class="pl-smi">Some</span><span class="pl-kos">&lt;</span><span class="pl-smi">a</span><span class="pl-kos">&gt;</span> <span class="pl-kos">{</span>
    <span class="pl-k">return</span> <span class="pl-kos">{</span> <span class="pl-c1">some</span>: <span class="pl-s1">value</span> <span class="pl-kos">}</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">function</span> <span class="pl-en">f2</span><span class="pl-kos">(</span><span class="pl-kos">)</span> : <span class="pl-smi">Optional</span><span class="pl-kos">&lt;</span><span class="pl-kos">[</span><span class="pl-smi">number</span><span class="pl-kos">,</span> <span class="pl-smi">number</span><span class="pl-kos">]</span><span class="pl-kos">&gt;</span> <span class="pl-kos">{</span>
    <span class="pl-k">return</span> <span class="pl-en">some</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-kos">;</span> <span class="pl-c">// doesn't work</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">Tuple types aren't always inferred when calling generic functions. For example:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="function identity&lt;A&gt;(value: A): A {
    return value
}

// works
const [a1, b1]: [number, string] = [1, 'a']

// works
const [a2, b2]: [number, string] = identity&lt;[number, string]&gt;([1, 'a'])

// breaks
const [a3, b3]: [number, string] = identity([1, 'a'])"><pre class="notranslate"><code class="notranslate">function identity&lt;A&gt;(value: A): A {
    return value
}

// works
const [a1, b1]: [number, string] = [1, 'a']

// works
const [a2, b2]: [number, string] = identity&lt;[number, string]&gt;([1, 'a'])

// breaks
const [a3, b3]: [number, string] = identity([1, 'a'])
</code></pre></div>
<p dir="auto">Output:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="foo.ts(12,7): error TS2322: Type '(number | string)[]' is not assignable to type '[number, string]'.
  Property '0' is missing in type '(number | string)[]'."><pre class="notranslate"><code class="notranslate">foo.ts(12,7): error TS2322: Type '(number | string)[]' is not assignable to type '[number, string]'.
  Property '0' is missing in type '(number | string)[]'.
</code></pre></div>
<p dir="auto">See also <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="59609104" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/2189" data-hovercard-type="issue" data-hovercard-url="/microsoft/TypeScript/issues/2189/hovercard" href="https://github.com/microsoft/TypeScript/issues/2189">#2189</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="98871819" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/4136" data-hovercard-type="issue" data-hovercard-url="/microsoft/TypeScript/issues/4136/hovercard" href="https://github.com/microsoft/TypeScript/issues/4136">#4136</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="121560624" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/6037" data-hovercard-type="issue" data-hovercard-url="/microsoft/TypeScript/issues/6037/hovercard" href="https://github.com/microsoft/TypeScript/issues/6037">#6037</a>.</p>