<p dir="auto"><em>From <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/egamma/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/egamma">@egamma</a> on January 22, 2016 9:10</em></p>
<p dir="auto">Setup<br>
{<br>
"compilerOptions": {<br>
"module": "commonjs",<br>
"target": "es5",<br>
"allowJs": true<br>
},<br>
"exclude": [<br>
"node_modules"<br>
]<br>
}</p>
<p dir="auto">Create a single file with a single function.</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/172399/12506560/2c0b9f40-c0f0-11e5-80c4-efc124be7d65.png"><img src="https://cloud.githubusercontent.com/assets/172399/12506560/2c0b9f40-c0f0-11e5-80c4-efc124be7d65.png" alt="symbols" style="max-width: 100%;"></a></p>
<p dir="auto"><em>Copied from original issue: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="128113817" data-permission-text="Title is private" data-url="https://github.com/microsoft/vscode/issues/2172" data-hovercard-type="issue" data-hovercard-url="/microsoft/vscode/issues/2172/hovercard" href="https://github.com/microsoft/vscode/issues/2172">microsoft/vscode#2172</a></em></p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="interface Foo {
    x;
}
interface Bar { }

var foo: Foo;
var bar: Bar;

foo = bar;
// Type 'Bar' is not assignable to type 'Foo':
//  Property 'x' is missing in type 'Bar'.

foo = bar;
// Type 'Bar' is not assignable to type 'Foo'."><pre class="notranslate"><span class="pl-k">interface</span> <span class="pl-smi">Foo</span> <span class="pl-kos">{</span>
    <span class="pl-c1">x</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>
<span class="pl-k">interface</span> <span class="pl-smi">Bar</span> <span class="pl-kos">{</span> <span class="pl-kos">}</span>

<span class="pl-k">var</span> <span class="pl-s1">foo</span>: <span class="pl-smi">Foo</span><span class="pl-kos">;</span>
<span class="pl-k">var</span> <span class="pl-s1">bar</span>: <span class="pl-smi">Bar</span><span class="pl-kos">;</span>

<span class="pl-s1">foo</span> <span class="pl-c1">=</span> <span class="pl-s1">bar</span><span class="pl-kos">;</span>
<span class="pl-c">// Type 'Bar' is not assignable to type 'Foo':</span>
<span class="pl-c">//  Property 'x' is missing in type 'Bar'.</span>

<span class="pl-s1">foo</span> <span class="pl-c1">=</span> <span class="pl-s1">bar</span><span class="pl-kos">;</span>
<span class="pl-c">// Type 'Bar' is not assignable to type 'Foo'.</span></pre></div>
<p dir="auto">This happens because we cache the results of assignability checks. And the elaboration portion of an assignability error is obtained by side effects that get short circuited on a cache hit.</p>