<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class FooError extends Error {
    constructor(message:string) {
        super(message);
    }
}
console.log((new FooError('foo')).message); // &lt;nothing&gt;
console.log((new Error('bar')).message); // bar"><pre class="notranslate"><span class="pl-k">class</span> <span class="pl-smi">FooError</span> <span class="pl-k">extends</span> <span class="pl-smi">Error</span> <span class="pl-kos">{</span>
    <span class="pl-en">constructor</span><span class="pl-kos">(</span><span class="pl-s1">message</span>:<span class="pl-smi">string</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">message</span><span class="pl-kos">)</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-kos">(</span><span class="pl-k">new</span> <span class="pl-smi">FooError</span><span class="pl-kos">(</span><span class="pl-s">'foo'</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-c1">message</span><span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-c">// &lt;nothing&gt;</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-kos">(</span><span class="pl-k">new</span> <span class="pl-smi">Error</span><span class="pl-kos">(</span><span class="pl-s">'bar'</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-c1">message</span><span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-c">// bar</span></pre></div>
<p dir="auto">Am I missing something obvious or is there a bug with 1.8.9?</p>
<p dir="auto">Test case:</p>
<p dir="auto">myError.ts</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class MyError extends Error {
    constructor(message: string) {
        super(message);
    }
}

let error = new MyError('Error Message');
console.log(error.message);"><pre class="notranslate"><span class="pl-k">class</span> <span class="pl-smi">MyError</span> <span class="pl-k">extends</span> <span class="pl-smi">Error</span> <span class="pl-kos">{</span>
    <span class="pl-en">constructor</span><span class="pl-kos">(</span><span class="pl-s1">message</span>: <span class="pl-smi">string</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">message</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">let</span> <span class="pl-s1">error</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-smi">MyError</span><span class="pl-kos">(</span><span class="pl-s">'Error Message'</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-s1">error</span><span class="pl-kos">.</span><span class="pl-c1">message</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">tsconfig.json</p>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
    &quot;compilerOptions&quot;: {
        &quot;target&quot;: &quot;ES5&quot;,
        &quot;module&quot;: &quot;commonjs&quot;
    }
}"><pre class="notranslate">{
    <span class="pl-ent">"compilerOptions"</span>: {
        <span class="pl-ent">"target"</span>: <span class="pl-s"><span class="pl-pds">"</span>ES5<span class="pl-pds">"</span></span>,
        <span class="pl-ent">"module"</span>: <span class="pl-s"><span class="pl-pds">"</span>commonjs<span class="pl-pds">"</span></span>
    }
}</pre></div>
<p dir="auto">compile and run using node:</p>
<p dir="auto">node myError.js</p>
<p dir="auto">Observe: nothing is printed to the console. Debugging it shows that the message passed to super is not recorded. Something seems very strange with the prototype chain in this case.</p>
<p dir="auto">I was under the impression from <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="88569754" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/3516" data-hovercard-type="pull_request" data-hovercard-url="/microsoft/TypeScript/pull/3516/hovercard" href="https://github.com/microsoft/TypeScript/pull/3516">#3516</a> that this should work now even if generating ES5 code. If not possible for ES5 then the compiler should produce an error.</p>