<p dir="auto"><strong>TypeScript Version:</strong></p>
<p dir="auto">1.8.2.</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="// A self-contained demonstration of the problem follows...
class Foo {
    bar: &quot;fizz&quot; | &quot;buzz&quot;;
}

class Bar extends Foo {
    bar = &quot;fizz&quot;;
}"><pre class="notranslate"><span class="pl-c">// A self-contained demonstration of the problem follows...</span>
<span class="pl-k">class</span> <span class="pl-smi">Foo</span> <span class="pl-kos">{</span>
    <span class="pl-c1">bar</span>: <span class="pl-s">"fizz"</span> <span class="pl-c1">|</span> <span class="pl-s">"buzz"</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">class</span> <span class="pl-smi">Bar</span> <span class="pl-k">extends</span> <span class="pl-smi">Foo</span> <span class="pl-kos">{</span>
    <span class="pl-c1">bar</span> <span class="pl-c1">=</span> <span class="pl-s">"fizz"</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto"><strong>Expected behavior:</strong><br>
<code class="notranslate">Bar.bar</code> is initialized to <code class="notranslate">"fizz"</code>;</p>
<p dir="auto"><strong>Actual behavior:</strong><br>
<code class="notranslate">Type 'string' is not assignable to type '"buzz"'</code></p>
<p dir="auto">Let's use:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="interface A = {
   data: number;
}
interface B = {
  data: string;
}
interface C extends A, B {}"><pre class="notranslate"><span class="pl-k">interface</span> <span class="pl-smi">A</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span>
   <span class="pl-c1">data</span>: <span class="pl-smi">number</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>
<span class="pl-k">interface</span> <span class="pl-smi">B</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span>
  <span class="pl-c1">data</span>: <span class="pl-smi">string</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>
<span class="pl-k">interface</span> <span class="pl-smi">C</span> <span class="pl-k">extends</span> <span class="pl-smi">A</span><span class="pl-kos">,</span> <span class="pl-smi">B</span> <span class="pl-kos">{</span><span class="pl-kos">}</span></pre></div>
<p dir="auto">This will throw an error as data has two separately defined types. I think that it would be really useful to allow C to become a union of the two interfaces either implicitly or to allow explicit unions of the conflicting types. The ultimate result being that:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="interface C extends A, B {} = { data: number | string; }"><pre class="notranslate"><span class="pl-k">interface</span> <span class="pl-smi">C</span> <span class="pl-k">extends</span> <span class="pl-smi">A</span><span class="pl-kos">,</span> <span class="pl-smi">B</span> <span class="pl-kos">{</span><span class="pl-kos">}</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span> data: <span class="pl-s1">number</span> <span class="pl-c1">|</span> <span class="pl-s1">string</span><span class="pl-kos">;</span> <span class="pl-kos">}</span></pre></div>
<p dir="auto">Otherwise, a new interface would have to be created which would be a duplication of effort or the type would have to be overridden with any, which defeats the purpose of having strict types.</p>
<p dir="auto">It's just a thought, but since TypeScript allows multiple inheritance with interfaces and has union types, I thought that this could be a beneficial merging of the two ideas.</p>