<p dir="auto"><strong>TypeScript Version:</strong></p>
<p dir="auto">nightly (1.9.0-dev.20160429)</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="function isFoo(value: any): value is Foo {
    return value &amp;&amp; typeof value.foo === 'function';
}

interface Foo {
    foo(): string;
}

interface Bar {
    bar(): string;
}

function convertBar(input: Foo | Bar): () =&gt; string {
    return isFoo(input) ? function () {
        return input.foo(); // &lt;-- Property 'foo' does not exist on type 'Foo | Bar'.
    } : input.bar;
}"><pre class="notranslate"><span class="pl-k">function</span> <span class="pl-en">isFoo</span><span class="pl-kos">(</span><span class="pl-s1">value</span>: <span class="pl-smi">any</span><span class="pl-kos">)</span>: <span class="pl-s1">value</span> is <span class="pl-smi">Foo</span> <span class="pl-kos">{</span>
    <span class="pl-k">return</span> <span class="pl-s1">value</span> <span class="pl-c1">&amp;&amp;</span> <span class="pl-k">typeof</span> <span class="pl-s1">value</span><span class="pl-kos">.</span><span class="pl-c1">foo</span> <span class="pl-c1">===</span> <span class="pl-s">'function'</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">interface</span> <span class="pl-smi">Foo</span> <span class="pl-kos">{</span>
    <span class="pl-c1">foo</span><span class="pl-kos">(</span><span class="pl-kos">)</span>: <span class="pl-smi">string</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-c1">bar</span><span class="pl-kos">(</span><span class="pl-kos">)</span>: <span class="pl-smi">string</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">function</span> <span class="pl-en">convertBar</span><span class="pl-kos">(</span><span class="pl-s1">input</span>: <span class="pl-smi">Foo</span> <span class="pl-c1">|</span> <span class="pl-smi">Bar</span><span class="pl-kos">)</span>: <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-smi">string</span> <span class="pl-kos">{</span>
    <span class="pl-k">return</span> <span class="pl-en">isFoo</span><span class="pl-kos">(</span><span class="pl-s1">input</span><span class="pl-kos">)</span> ? <span class="pl-k">function</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-k">return</span> <span class="pl-s1">input</span><span class="pl-kos">.</span><span class="pl-en">foo</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-c">// &lt;-- Property 'foo' does not exist on type 'Foo | Bar'.</span>
    <span class="pl-kos">}</span> : <span class="pl-s1">input</span><span class="pl-kos">.</span><span class="pl-c1">bar</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto"><strong>Expected behavior:</strong></p>
<p dir="auto">Receive no errors (<a href="http://www.typescriptlang.org/play/#src=function%20isFoo%28value%3A%20any%29%3A%20value%20is%20Foo%20%7B%0A%09return%20value%20%26%26%20typeof%20value.foo%20%3D%3D%3D%20'function'%3B%0A%7D%0A%0Ainterface%20Foo%20%7B%0A%09foo%28%29%3A%20string%3B%0A%7D%0A%0Ainterface%20Bar%20%7B%0A%09bar%28%29%3A%20string%3B%0A%7D%0A%0Afunction%20convertBar%28input%3A%20Foo%20%7C%20Bar%29%3A%20%28%29%20%3D%3E%20string%20%7B%0A%09return%20isFoo%28input%29%20%3F%20function%20%28%29%20%7B%0A%09%09return%20input.foo%28%29%3B%0A%09%7D%20%3A%20input.bar%3B%0A%7D%0A" rel="nofollow">as per 1.8</a>)</p>
<p dir="auto"><strong>Actual behavior:</strong></p>
<p dir="auto">Receive the error <code class="notranslate">Property 'foo' does not exist on type 'Foo | Bar'.</code></p>
<p dir="auto"><strong>TypeScript Version:</strong></p>
<p dir="auto">1.7.5 (TS6029)</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="// var t = 0; if(t) { document.write('defined'); } else { document.write('undefined'); }
"><pre class="notranslate"><span class="pl-c">// var t = 0; if(t) { document.write('defined'); } else { document.write('undefined'); }</span></pre></div>
<p dir="auto"><strong>Expected behavior:</strong></p>
<p dir="auto">the variable is defined</p>
<p dir="auto"><strong>Actual behavior:</strong></p>
<p dir="auto">the variable is undefined</p>
<p dir="auto"><strong>Prove at Playground:</strong><br>
<a href="http://goo.gl/UI4ymi" rel="nofollow">http://goo.gl/UI4ymi</a></p>