<p dir="auto">When creating and using an enum (TypeScript 1.4, Visual Studio 2013). When I build the project the enum value is compiled to a number, but if I save the file the compiled output is the full name of the enum. For example:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// enum.ts
enum SomeEnum {
    One = 1,
    Two = 2
}"><pre class="notranslate"><span class="pl-c">// enum.ts</span>
<span class="pl-k">enum</span> <span class="pl-smi">SomeEnum</span> <span class="pl-kos">{</span>
    <span class="pl-c1">One</span> <span class="pl-c1">=</span> <span class="pl-c1">1</span><span class="pl-kos">,</span>
    <span class="pl-c1">Two</span> <span class="pl-c1">=</span> <span class="pl-c1">2</span>
<span class="pl-kos">}</span></pre></div>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// consumer.ts
class Consumer {
    public doSomething(): void {
        var x: SomeEnum = SomeEnum.One;
    } 
} "><pre class="notranslate"><span class="pl-c">// consumer.ts</span>
<span class="pl-k">class</span> <span class="pl-smi">Consumer</span> <span class="pl-kos">{</span>
    <span class="pl-k">public</span> <span class="pl-en">doSomething</span><span class="pl-kos">(</span><span class="pl-kos">)</span>: <span class="pl-smi"><span class="pl-k">void</span></span> <span class="pl-kos">{</span>
        <span class="pl-k">var</span> <span class="pl-s1">x</span>: <span class="pl-smi">SomeEnum</span> <span class="pl-c1">=</span> <span class="pl-smi">SomeEnum</span><span class="pl-kos">.</span><span class="pl-c1">One</span><span class="pl-kos">;</span>
    <span class="pl-kos">}</span> 
<span class="pl-kos">}</span> </pre></div>
<p dir="auto">When the project is built, it compiles to:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="var Consumer = (function () {
    function Consumer() {
    }
    Consumer.prototype.doSomething = function () {
        var x = 1 /* One */;
    };
    return Consumer;
})();"><pre class="notranslate"><span class="pl-k">var</span> <span class="pl-v">Consumer</span> <span class="pl-c1">=</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">function</span> <span class="pl-v">Consumer</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-kos">}</span>
    <span class="pl-v">Consumer</span><span class="pl-kos">.</span><span class="pl-c1">prototype</span><span class="pl-kos">.</span><span class="pl-en">doSomething</span> <span class="pl-c1">=</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">var</span> <span class="pl-s1">x</span> <span class="pl-c1">=</span> <span class="pl-c1">1</span> <span class="pl-c">/* One */</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-v">Consumer</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">However when I edit and save "consumer.ts" it compiles to:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="var Consumer = (function () {
    function Consumer() {
    }
    Consumer.prototype.doSomething = function () {
        var x = SomeEnum.One;
    };
    return Consumer;
})();"><pre class="notranslate"><span class="pl-k">var</span> <span class="pl-v">Consumer</span> <span class="pl-c1">=</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">function</span> <span class="pl-v">Consumer</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-kos">}</span>
    <span class="pl-v">Consumer</span><span class="pl-kos">.</span><span class="pl-c1">prototype</span><span class="pl-kos">.</span><span class="pl-en">doSomething</span> <span class="pl-c1">=</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">var</span> <span class="pl-s1">x</span> <span class="pl-c1">=</span> <span class="pl-v">SomeEnum</span><span class="pl-kos">.</span><span class="pl-c1">One</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-v">Consumer</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">The issue is that the enum values are sitting in a DomainModels.d.ts file (that is converted from C# using TypeLite). So the definition of the enum is never included in the output.</p>
<p dir="auto">The preferred output would be always compiling to a number.</p>
<p dir="auto">I have an enum in an interface that, when used in my TS code in TypeScript 1.3, was output as a constant. This is no longer the case in 1.4 after saving my file. When i build the project, the enum code is properly output as a constant. Using VS 2013 update 4 with TypeScript 1.4 installed.</p>
<p dir="auto">Enum declaration file (Colors.d.ts):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="declare module server {
    enum Colors {
        Red = 0,
        Green = 0,
        Blue = 0
    }
}"><pre class="notranslate"><code class="notranslate">declare module server {
    enum Colors {
        Red = 0,
        Green = 0,
        Blue = 0
    }
}
</code></pre></div>
<p dir="auto">TS Code:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="if(box.color === server.Colors.Red) {
...
}"><pre class="notranslate"><code class="notranslate">if(box.color === server.Colors.Red) {
...
}
</code></pre></div>
<p dir="auto">JS Output after save:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="if(box.color === server.Colors.Red) {
...
}"><pre class="notranslate"><code class="notranslate">if(box.color === server.Colors.Red) {
...
}
</code></pre></div>
<p dir="auto">JS Output after build (correct, or what i consider to be correct since there is no implementation of the enum):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="if(box.color === 0 /* Red */) {
...
}"><pre class="notranslate"><code class="notranslate">if(box.color === 0 /* Red */) {
...
}
</code></pre></div>
<p dir="auto">The same is observed if the enum is declared using the new "const enum" feature.</p>