<p dir="auto">This is valid typescript</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="interface Bar {
    name: string;
}

export default Bar;
"><pre class="notranslate"><span class="pl-k">interface</span> <span class="pl-smi">Bar</span> <span class="pl-kos">{</span>
    <span class="pl-c1">name</span>: <span class="pl-smi">string</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">export</span> <span class="pl-k">default</span> <span class="pl-smi">Bar</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">However, the compiler complains if I do this:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="export default interface Bar {
    name: string;
}
"><pre class="notranslate"><span class="pl-k">export</span> <span class="pl-k">default</span> <span class="pl-k">interface</span> <span class="pl-smi">Bar</span> <span class="pl-kos">{</span>
    <span class="pl-c1">name</span>: <span class="pl-smi">string</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">I would have expected this to work in both cases as if I substitute <code class="notranslate">interface</code> with <code class="notranslate">class</code> it works fine.</p>
<p dir="auto">Reading the spec here, <a href="https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#11.3.4">https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#11.3.4</a>, shows that interfaces cannot be part of a default export, but why?</p>
<p dir="auto">Thanks!</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="export default abstract class B {

}"><pre class="notranslate"><code class="notranslate">export default abstract class B {

}
</code></pre></div>
<p dir="auto">By the way, the same with</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="export default declare class B {

}"><pre class="notranslate"><code class="notranslate">export default declare class B {

}
</code></pre></div>
<p dir="auto">Seems to be a parser bug</p>