<p dir="auto"><strong>TypeScript Version:</strong></p>
<p dir="auto">1.8.7</p>
<p dir="auto"><strong>Code</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="for"><pre class="notranslate"><code class="notranslate">for
</code></pre></div>
<p dir="auto"><strong>Expected behavior:</strong><br>
Emit something that's not an infinite loop. It's a syntax error so it should probably stay a syntax error in the output js.<br>
<strong>Actual behavior:</strong><br>
A for loop with no parameters or body emits this:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="for (; ; )
    ;"><pre class="notranslate"><code class="notranslate">for (; ; )
    ;
</code></pre></div>
<p dir="auto">Consider this code:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class Super {
  _view:Element;

  constructor(view?:Element) {
    this._view = view || document.createElement('div');
  };
}

class Inherits extends Super {
  test = 1;
  view:Element;

  constructor() {
    let view = document.createElement('span');
    super(view);

    this.view = view;
  };
}"><pre class="notranslate"><span class="pl-k">class</span> <span class="pl-smi">Super</span> <span class="pl-kos">{</span>
  <span class="pl-c1">_view</span>:<span class="pl-smi">Element</span><span class="pl-kos">;</span>

  <span class="pl-en">constructor</span><span class="pl-kos">(</span><span class="pl-s1">view</span>?:<span class="pl-smi">Element</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">_view</span> <span class="pl-c1">=</span> <span class="pl-s1">view</span> <span class="pl-c1">||</span> <span class="pl-smi">document</span><span class="pl-kos">.</span><span class="pl-en">createElement</span><span class="pl-kos">(</span><span class="pl-s">'div'</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-k">class</span> <span class="pl-smi">Inherits</span> <span class="pl-k">extends</span> <span class="pl-smi">Super</span> <span class="pl-kos">{</span>
  <span class="pl-c1">test</span> <span class="pl-c1">=</span> <span class="pl-c1">1</span><span class="pl-kos">;</span>
  <span class="pl-c1">view</span>:<span class="pl-smi">Element</span><span class="pl-kos">;</span>

  <span class="pl-en">constructor</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-k">let</span> <span class="pl-s1">view</span> <span class="pl-c1">=</span> <span class="pl-smi">document</span><span class="pl-kos">.</span><span class="pl-en">createElement</span><span class="pl-kos">(</span><span class="pl-s">'span'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-smi">super</span><span class="pl-kos">(</span><span class="pl-s1">view</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

    <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">view</span> <span class="pl-c1">=</span> <span class="pl-s1">view</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">And it says: <code class="notranslate">2376 A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.</code></p>
<p dir="auto">I understand that it's because of <code class="notranslate">test</code> property. but can you allow not-<code class="notranslate">this</code> code before <code class="notranslate">super()</code> call how ES6 does?</p>
<p dir="auto">Also, this won't work too, of course:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class Inherits extends Super {
  test = 1;
  view:Element = document.createElement('span');

  constructor() {
    super(this.view); // 2332 'this' cannot be referenced in current location.
  };
}"><pre class="notranslate"><span class="pl-k">class</span> <span class="pl-smi">Inherits</span> <span class="pl-k">extends</span> <span class="pl-smi">Super</span> <span class="pl-kos">{</span>
  <span class="pl-c1">test</span> <span class="pl-c1">=</span> <span class="pl-c1">1</span><span class="pl-kos">;</span>
  <span class="pl-c1">view</span>:<span class="pl-smi">Element</span> <span class="pl-c1">=</span> <span class="pl-smi">document</span><span class="pl-kos">.</span><span class="pl-en">createElement</span><span class="pl-kos">(</span><span class="pl-s">'span'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

  <span class="pl-en">constructor</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-smi">super</span><span class="pl-kos">(</span><span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">view</span><span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-c">// 2332 'this' cannot be referenced in current location.</span>
  <span class="pl-kos">}</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>