<p dir="auto">TypeScript version 1.8.9</p>
<p dir="auto"><strong>Code</strong></p>
<p dir="auto">File 1</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="export const enum Foo {
    Bar
}"><pre class="notranslate"><span class="pl-k">export</span> <span class="pl-k">const</span> <span class="pl-k">enum</span> <span class="pl-smi">Foo</span> <span class="pl-kos">{</span>
    <span class="pl-c1">Bar</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">FIle2.ts</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import file1 = require(&quot;./file1&quot;);
var x = file1.Foo.Bar;"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">file1</span> <span class="pl-c1">=</span> require<span class="pl-kos">(</span><span class="pl-s">"./file1"</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-k">var</span> <span class="pl-s1">x</span> <span class="pl-c1">=</span> <span class="pl-s1">file1</span><span class="pl-kos">.</span><span class="pl-c1">Foo</span><span class="pl-kos">.</span><span class="pl-c1">Bar</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">Generated JavaScript File2.js</p>
<p dir="auto"><strong>Expected behavior:</strong></p>
<p dir="auto">define(["require", "exports"], function (require, exports) {<br>
"use strict";<br>
var x = 0 /* Bar */;<br>
});</p>
<p dir="auto"><strong>Actual behavior:</strong></p>
<p dir="auto">define(["require", "exports", "./file1"], function (require, exports, file1) {<br>
"use strict";<br>
var x = 0 /* Bar */;<br>
});</p>
<p dir="auto">It would be great if file2.js doesn't pull in file1.js as a dependency.</p>
<p dir="auto">We noticed this happens when we use const enums.</p>
<p dir="auto">I'm currently converting a project to use the new es6 module style (which is really a great feature!). The compiler removes all references to modules I'm using only typing information from which makes absolutely sense. However, when accessing a constant enumeration the require call will be preserved in js output although it is not needed, e.g.:</p>
<p dir="auto"><strong>a.ts</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="export const enum MyEnum {
    ValueA,
    ValueB,
    ValueC
}"><pre class="notranslate"><code class="notranslate">export const enum MyEnum {
    ValueA,
    ValueB,
    ValueC
}
</code></pre></div>
<p dir="auto"><strong>b.ts</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import * as a from &quot;./a&quot;;
export var myValue = a.MyEnum.ValueB;"><pre class="notranslate"><code class="notranslate">import * as a from "./a";
export var myValue = a.MyEnum.ValueB;
</code></pre></div>
<p dir="auto">Now, <code class="notranslate">b.ts</code> compiles to this, note the unnecessary <code class="notranslate">require</code> call:</p>
<p dir="auto"><strong>b.js</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="var a = require(&quot;./a&quot;);
exports.myValue = 1;"><pre class="notranslate"><code class="notranslate">var a = require("./a");
exports.myValue = 1;
</code></pre></div>
<p dir="auto">First I thought this is my fault but then I tried to use the imported types solely as type arguments which results in the compiler removing the require call correctly, e.g.:</p>
<p dir="auto"><strong>c.ts</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import * as a from &quot;./a&quot;;

export function myFunction(value:a.MyEnum):string {
    return &quot;myReturn&quot;;
}"><pre class="notranslate"><code class="notranslate">import * as a from "./a";

export function myFunction(value:a.MyEnum):string {
    return "myReturn";
}
</code></pre></div>
<p dir="auto">Will compile to this:</p>
<p dir="auto"><strong>c.js</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="function myFunction(value) {
    return &quot;myReturn&quot;;
}
exports.myFunction = myFunction;"><pre class="notranslate"><code class="notranslate">function myFunction(value) {
    return "myReturn";
}
exports.myFunction = myFunction;
</code></pre></div>