<p dir="auto">If I compile the following code on the old compiler (with the module command line flag) I get the error 'error TS2058: Return type of exported function has or is using private type 'MyElement'.'</p>
<p dir="auto">If I use the new compiler and the --module flag it compiles with no complaints</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="export module Foo
{
    interface MyElement extends HTMLElement { 
    } 

    export function bar(): MyElement {
        return null;    
    }
}

"><pre class="notranslate"><span class="pl-s1">export</span> <span class="pl-smi">module</span> <span class="pl-v">Foo</span>
<span class="pl-kos">{</span>
    <span class="pl-s1">interface</span> <span class="pl-v">MyElement</span> <span class="pl-k">extends</span> <span class="pl-v">HTMLElement</span> <span class="pl-kos">{</span> 
    <span class="pl-kos">}</span> 

    <span class="pl-k">export</span> <span class="pl-k">function</span> <span class="pl-en">bar</span><span class="pl-kos">(</span><span class="pl-kos">)</span>: <span class="pl-v">MyElement</span> <span class="pl-kos">{</span>
        <span class="pl-k">return</span> <span class="pl-c1">null</span><span class="pl-kos">;</span>    
    <span class="pl-kos">}</span>
<span class="pl-kos">}</span>
</pre></div>
<p dir="auto"><strong>TypeScript Version:</strong></p>
<p dir="auto">1.8.10</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="let a;
let b = { a as string };
let c = { &lt;string&gt; a };"><pre class="notranslate"><span class="pl-k">let</span> <span class="pl-s1">a</span><span class="pl-kos">;</span>
<span class="pl-k">let</span> <span class="pl-s1">b</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span> <span class="pl-s1">a</span> <span class="pl-s1">as</span> string <span class="pl-kos">}</span><span class="pl-kos">;</span>
<span class="pl-k">let</span> <span class="pl-s1">c</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span> <span class="pl-kos">&lt;</span><span class="pl-smi">string</span><span class="pl-kos">&gt;</span> <span class="pl-s1">a</span> <span class="pl-kos">}</span><span class="pl-kos">;</span></pre></div>
<p dir="auto"><strong>Expected behavior:</strong><br>
The type of <code class="notranslate">b</code> and <code class="notranslate">c</code> should be <code class="notranslate">{ a: string }</code> and the output should be this:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="var a;
var b = { a: a };
var c = { a: a };"><pre class="notranslate"><span class="pl-k">var</span> <span class="pl-s1">a</span><span class="pl-kos">;</span>
<span class="pl-k">var</span> <span class="pl-s1">b</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span> <span class="pl-c1">a</span>: <span class="pl-s1">a</span> <span class="pl-kos">}</span><span class="pl-kos">;</span>
<span class="pl-k">var</span> <span class="pl-s1">c</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span> <span class="pl-c1">a</span>: <span class="pl-s1">a</span> <span class="pl-kos">}</span><span class="pl-kos">;</span></pre></div>
<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="var a;
var b = { a: as, string: string };
var c = {} &lt; string &gt; a;
;"><pre class="notranslate"><span class="pl-k">var</span> <span class="pl-s1">a</span><span class="pl-kos">;</span>
<span class="pl-k">var</span> <span class="pl-s1">b</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span> <span class="pl-c1">a</span>: <span class="pl-s1">as</span><span class="pl-kos">,</span> <span class="pl-c1">string</span>: <span class="pl-s1">string</span> <span class="pl-kos">}</span><span class="pl-kos">;</span>
<span class="pl-k">var</span> <span class="pl-s1">c</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span><span class="pl-kos">}</span> <span class="pl-c1">&lt;</span> <span class="pl-s1">string</span> <span class="pl-c1">&gt;</span> <span class="pl-s1">a</span><span class="pl-kos">;</span>
<span class="pl-kos">;</span></pre></div>