<p dir="auto"><strong>TypeScript Version:</strong></p>
<p dir="auto">1.8.10</p>
<p dir="auto"><strong>Code</strong></p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="function Foo() {
  console.log(new.target);
}

new Foo();"><pre class="notranslate"><span class="pl-k">function</span> <span class="pl-smi">Foo</span><span class="pl-kos">(</span><span class="pl-kos">)</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-k">new</span><span class="pl-kos">.</span><span class="pl-k">target</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">new</span> <span class="pl-smi">Foo</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto"><strong>Expected behavior:</strong></p>
<p dir="auto">When targeting ES6, this should compile without an error.</p>
<p dir="auto"><code class="notranslate">new.target</code> is an <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/new.target" rel="nofollow">obscure bit of ES6</a>, but it is there, for example running the code in an <a href="https://jsfiddle.net/kitsonk/2qa0n8m3/2/" rel="nofollow">ES6 browser returns what is expected</a> in that <code class="notranslate">new.target === Foo</code>.  When it is just <code class="notranslate">Foo()</code> without <code class="notranslate">new</code> then <code class="notranslate">new.target === undefined</code>.</p>
<p dir="auto">While it maybe challenging to come up with an emit that works for ES5, it should be at least supported when targeting ES6.</p>
<p dir="auto">I suspect and emit for ES6 might be something like this:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="function Foo() {
  var _newTarget = this === window ? undefined : this &amp;&amp; this.constructor;
  console.log(_newTarget);
}"><pre class="notranslate"><span class="pl-k">function</span> <span class="pl-v">Foo</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">_newTarget</span> <span class="pl-c1">=</span> <span class="pl-smi">this</span> <span class="pl-c1">===</span> <span class="pl-smi">window</span> ? <span class="pl-c1">undefined</span> : <span class="pl-smi">this</span> <span class="pl-c1">&amp;&amp;</span> <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">constructor</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">_newTarget</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto"><strong>Actual behavior:</strong></p>
<p dir="auto">Compiles as:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ tsc --target es6 test.ts
test.ts(2,18): error TS1109: Expression expected."><pre class="notranslate"><code class="notranslate">$ tsc --target es6 test.ts
test.ts(2,18): error TS1109: Expression expected.
</code></pre></div>
<p dir="auto">There isn't a lot in the current ES6 spec draft, but it seems to indicate the constructor object that is in the process of being <code class="notranslate">new</code>'d at runtime.</p>