<p dir="auto">tsc version 1.4.1.0 (1.3.0 work correctly)<br>
tsc -w --out ../file.js file.ts</p>
<p dir="auto">file.ts</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="/// &lt;reference path=&quot;./interfaces.ts&quot;/&gt;
alert('1');"><pre class="notranslate"><span class="pl-c">/// &lt;reference path="./interfaces.ts"/&gt;</span>
<span class="pl-en">alert</span><span class="pl-kos">(</span><span class="pl-s">'1'</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">interfaces.ts</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="interface HashTable&lt;T&gt; {
    [key:string]: T;
}

/*interface Test {
}*/"><pre class="notranslate"><span class="pl-k">interface</span> <span class="pl-smi">HashTable</span><span class="pl-c1">&lt;</span><span class="pl-smi">T</span><span class="pl-c1">&gt;</span> <span class="pl-kos">{</span>
    <span class="pl-kos">[</span><span class="pl-s1">key</span>:<span class="pl-smi">string</span><span class="pl-kos">]</span>: <span class="pl-smi">T</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-c">/*interface Test {</span>
<span class="pl-c">}*/</span></pre></div>
<p dir="auto">( <em>multiline</em> comment closed on <em>last line of file</em>, no emtpy lines after it ). compiled to</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="/*interface Test {
interface HashTable&lt;T&gt; {
    [key:string]: T;
}

/*interface Test {

/// &lt;reference path=&quot;./interfaces.ts&quot;/&gt;
alert('1');"><pre class="notranslate"><span class="pl-c1">/</span><span class="pl-c1">*</span>interface Test <span class="pl-kos">{</span>
<span class="pl-s1">interface</span> <span class="pl-v">HashTable</span><span class="pl-c1">&lt;</span><span class="pl-v">T</span><span class="pl-c1">&gt;</span> <span class="pl-kos">{</span>
    <span class="pl-kos">[</span><span class="pl-s1">key</span>:<span class="pl-s1">string</span><span class="pl-kos">]</span>: <span class="pl-v">T</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-c1">/</span><span class="pl-c1">*</span>interface Test <span class="pl-kos">{</span>

<span class="pl-c">/// &lt;reference path="./interfaces.ts"/&gt;</span>
<span class="pl-en">alert</span><span class="pl-kos">(</span><span class="pl-s">'1'</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">last line of interfaces.ts dissapeared so comment block doesnt closed and result js file incorrect.</p>
<hr>
<p dir="auto">without reference<br>
typescript</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="interface HashTable&lt;T&gt; {
    [key:string]: T;
}
/*interface Test { 
*/"><pre class="notranslate"><span class="pl-k">interface</span> <span class="pl-smi">HashTable</span><span class="pl-c1">&lt;</span><span class="pl-smi">T</span><span class="pl-c1">&gt;</span> <span class="pl-kos">{</span>
    <span class="pl-kos">[</span><span class="pl-s1">key</span>:<span class="pl-smi">string</span><span class="pl-kos">]</span>: <span class="pl-smi">T</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>
<span class="pl-c">/*interface Test { </span>
<span class="pl-c">*/</span></pre></div>
<p dir="auto">js</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="/*interface Test {
interface HashTable&lt;T&gt; {
    [key:string]: T;
}

/*interface Test {
"><pre class="notranslate"><span class="pl-c1">/</span><span class="pl-c1">*</span>interface Test <span class="pl-kos">{</span>
<span class="pl-s1">interface</span> <span class="pl-v">HashTable</span><span class="pl-c1">&lt;</span><span class="pl-v">T</span><span class="pl-c1">&gt;</span> <span class="pl-kos">{</span>
    <span class="pl-kos">[</span><span class="pl-s1">key</span>:<span class="pl-s1">string</span><span class="pl-kos">]</span>: <span class="pl-v">T</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-c1">/</span><span class="pl-c1">*</span>interface Test <span class="pl-kos">{</span></pre></div>
<p dir="auto">Hi,</p>
<p dir="auto"><strong>TS Version</strong>: 1.4</p>
<p dir="auto">The following code:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="var x: any;
/*
var bar;
*/"><pre class="notranslate"><span class="pl-k">var</span> <span class="pl-s1">x</span>: <span class="pl-smi">any</span><span class="pl-kos">;</span>
<span class="pl-c">/*</span>
<span class="pl-c">var bar;</span>
<span class="pl-c">*/</span></pre></div>
<p dir="auto">Emits the following JavaScript</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="var x;
/*
var bar;
var x: any;
/*
var bar;"><pre class="notranslate"><span class="pl-k">var</span> <span class="pl-s1">x</span><span class="pl-kos">;</span>
<span class="pl-c1">/</span><span class="pl-c1">*</span>
<span class="pl-k">var</span> <span class="pl-s1">bar</span><span class="pl-kos">;</span>
<span class="pl-k">var</span> <span class="pl-s1">x</span>: <span class="pl-s1">any</span><span class="pl-kos">;</span>
<span class="pl-c1">/</span><span class="pl-c1">*</span>
<span class="pl-k">var</span> <span class="pl-s1">bar</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">Expected</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="var x;
/*
var bar;
*/"><pre class="notranslate"><span class="pl-k">var</span> <span class="pl-s1">x</span><span class="pl-kos">;</span>
<span class="pl-c">/*</span>
<span class="pl-c">var bar;</span>
<span class="pl-c">*/</span></pre></div>