<p dir="auto">Reported by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/mechanoid/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/mechanoid">@mechanoid</a>  here <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="116718119" data-permission-text="Title is private" data-url="https://github.com/TypeStrong/atom-typescript/issues/719" data-hovercard-type="issue" data-hovercard-url="/TypeStrong/atom-typescript/issues/719/hovercard" href="https://github.com/TypeStrong/atom-typescript/issues/719#issue-116718119">TypeStrong/atom-typescript#719 (comment)</a>  Tested with TypeScript nightly</p>
<p dir="auto">Sample from original issue report : <a href="https://github.com/mechanoid/ts-import-error-test">https://github.com/mechanoid/ts-import-error-test</a></p>
<p dir="auto">This is as minimal an example as I have for now (<code class="notranslate">tsc</code> version and <code class="notranslate">tsconfig.json</code> details at the bottom of this issue)</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class A {
    doIt(x: Array&lt;string&gt;): void {
        x.forEach((v) =&gt; {
            switch(v) {
                case &quot;test&quot;: console.log(this);
            }
        });
    }
}"><pre class="notranslate"><span class="pl-k">class</span> <span class="pl-smi">A</span> <span class="pl-kos">{</span>
    <span class="pl-en">doIt</span><span class="pl-kos">(</span><span class="pl-s1">x</span>: <span class="pl-smi">Array</span><span class="pl-kos">&lt;</span><span class="pl-smi">string</span><span class="pl-kos">&gt;</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-s1">x</span><span class="pl-kos">.</span><span class="pl-en">forEach</span><span class="pl-kos">(</span><span class="pl-kos">(</span><span class="pl-s1">v</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
            <span class="pl-k">switch</span><span class="pl-kos">(</span><span class="pl-s1">v</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
                <span class="pl-k">case</span> <span class="pl-s">"test"</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-smi">this</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">Comparing the transpiled output from <code class="notranslate">1.8.0-dev.20151109</code> and <code class="notranslate">1.8.0-dev.20151110</code> we see:</p>
<div class="highlight highlight-source-diff notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="--- app.js.1.8.0-dev.20151109   2015-11-12 16:02:01.064780316 +0000
+++ app.js.1.8.0-dev.20151110   2015-11-12 16:05:07.933061708 +0000
@@ -2,10 +2,9 @@
     function A() {
     }
     A.prototype.doIt = function (x) {
-        var _this = this;
         x.forEach(function (v) {
             switch (v) {
-                case &quot;test&quot;: console.log(_this);
+                case &quot;test&quot;: console.log(this);
             }
         });
     };"><pre class="notranslate"><span class="pl-md">--- app.js.1.8.0-dev.20151109   2015-11-12 16:02:01.064780316 +0000</span>
<span class="pl-mi1">+++ app.js.1.8.0-dev.20151110   2015-11-12 16:05:07.933061708 +0000</span>
<span class="pl-mdr">@@ -2,10 +2,9 @@</span>
     function A() {
     }
     A.prototype.doIt = function (x) {
<span class="pl-md"><span class="pl-md">-</span>        var _this = this;</span>
         x.forEach(function (v) {
             switch (v) {
<span class="pl-md"><span class="pl-md">-</span>                case "test": console.log(_this);</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>                case "test": console.log(this);</span>
             }
         });
     };</pre></div>
<p dir="auto">This feels like a bug to me... but I might have missed something?</p>
<p dir="auto">Thanks</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="message TS6029: Version 1.8.0-dev.20151110

{
  &quot;compilerOptions&quot;: {
    &quot;declaration&quot;: false,
    &quot;jsx&quot;: &quot;react&quot;,
    &quot;module&quot;: &quot;system&quot;,
    &quot;noImplicitAny&quot;: true,
    &quot;noLib&quot;: true,
    &quot;outDir&quot;: &quot;../dist/&quot;,
    &quot;removeComments&quot;: false,
    &quot;rootDir&quot;: &quot;.&quot;,
    &quot;sourceMap&quot;: true,
    &quot;target&quot;: &quot;es5&quot;
  }
}"><pre class="notranslate"><code class="notranslate">message TS6029: Version 1.8.0-dev.20151110

{
  "compilerOptions": {
    "declaration": false,
    "jsx": "react",
    "module": "system",
    "noImplicitAny": true,
    "noLib": true,
    "outDir": "../dist/",
    "removeComments": false,
    "rootDir": ".",
    "sourceMap": true,
    "target": "es5"
  }
}
</code></pre></div>