<p dir="auto">ts:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="let f: any;
(() =&gt; f = () =&gt; 0)();
export {f} // f is defined"><pre class="notranslate"><span class="pl-k">let</span> <span class="pl-s1">f</span>: <span class="pl-smi">any</span><span class="pl-kos">;</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-en">f</span> <span class="pl-c1">=</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-c1">0</span><span class="pl-kos">)</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-k">export</span> <span class="pl-kos">{</span><span class="pl-s1">f</span><span class="pl-kos">}</span> <span class="pl-c">// f is defined</span></pre></div>
<p dir="auto">emit:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&quot;use strict&quot;;
var f;
exports.f = f; // f is undefined
(function () { return f = function () { return 0; }; })();"><pre class="notranslate"><span class="pl-s">"use strict"</span><span class="pl-kos">;</span>
<span class="pl-k">var</span> <span class="pl-s1">f</span><span class="pl-kos">;</span>
<span class="pl-s1">exports</span><span class="pl-kos">.</span><span class="pl-c1">f</span> <span class="pl-c1">=</span> <span class="pl-s1">f</span><span class="pl-kos">;</span> <span class="pl-c">// f is undefined</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">f</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">return</span> <span class="pl-c1">0</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><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">Hi,</p>
<p dir="auto">If I have the following typescript code:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="var obj = {
    someKey: 6
};

// For some reason I want to change the object
obj = {
    someKey: 7
};

export {obj};"><pre class="notranslate"><span class="pl-k">var</span> <span class="pl-s1">obj</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span>
    <span class="pl-c1">someKey</span>: <span class="pl-c1">6</span>
<span class="pl-kos">}</span><span class="pl-kos">;</span>

<span class="pl-c">// For some reason I want to change the object</span>
<span class="pl-s1">obj</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span>
    <span class="pl-c1">someKey</span>: <span class="pl-c1">7</span>
<span class="pl-kos">}</span><span class="pl-kos">;</span>

<span class="pl-k">export</span> <span class="pl-kos">{</span><span class="pl-s1">obj</span><span class="pl-kos">}</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">it compiles to:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="var obj = {
    someKey: 6
};
exports.obj = obj;
obj = {
    someKey: 7
};"><pre class="notranslate"><span class="pl-k">var</span> <span class="pl-s1">obj</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span>
    <span class="pl-c1">someKey</span>: <span class="pl-c1">6</span>
<span class="pl-kos">}</span><span class="pl-kos">;</span>
<span class="pl-s1">exports</span><span class="pl-kos">.</span><span class="pl-c1">obj</span> <span class="pl-c1">=</span> <span class="pl-s1">obj</span><span class="pl-kos">;</span>
<span class="pl-s1">obj</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span>
    <span class="pl-c1">someKey</span>: <span class="pl-c1">7</span>
<span class="pl-kos">}</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">So if I importing the object I get:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import {obj} from './some-file';
console.log(obj.someKey === 6); // true"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-kos">{</span><span class="pl-s1">obj</span><span class="pl-kos">}</span> <span class="pl-k">from</span> <span class="pl-s">'./some-file'</span><span class="pl-kos">;</span>
<span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">obj</span><span class="pl-kos">.</span><span class="pl-c1">someKey</span> <span class="pl-c1">===</span> <span class="pl-c1">6</span><span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-c">// true</span></pre></div>
<p dir="auto">But I was expecting <code class="notranslate">7</code>. I.e. I was expecting the following JS code:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="var obj = {
    someKey: 6
};
obj = {
    someKey: 7
};
exports.obj = obj;"><pre class="notranslate"><span class="pl-k">var</span> <span class="pl-s1">obj</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span>
    <span class="pl-c1">someKey</span>: <span class="pl-c1">6</span>
<span class="pl-kos">}</span><span class="pl-kos">;</span>
<span class="pl-s1">obj</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span>
    <span class="pl-c1">someKey</span>: <span class="pl-c1">7</span>
<span class="pl-kos">}</span><span class="pl-kos">;</span>
<span class="pl-s1">exports</span><span class="pl-kos">.</span><span class="pl-c1">obj</span> <span class="pl-c1">=</span> <span class="pl-s1">obj</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">Is this a bug or expected behavior?</p>
<p dir="auto">I am using version <code class="notranslate">1.6.0-dev.20150731</code> but it has the same behavior in <code class="notranslate">1.5.3</code>.</p>