<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="interface Foo {
    ok:string;
    okToo: number;
    notOk:  &quot;o&quot; | &quot;k&quot;;
}

interface Bar {
    bar: string;
}

interface FooBar extends Foo, Bar{
}

function mix&lt;T&gt;(obj:T): T &amp; Bar {
    (obj as any).bar=&quot;bar&quot;;
    return obj as T &amp; Bar;
}

var fooBar:FooBar = mix({
    ok:&quot;ok&quot;,
    okToo: 42,
    notOk:&quot;k&quot;
});"><pre class="notranslate"><span class="pl-k">interface</span> <span class="pl-smi">Foo</span> <span class="pl-kos">{</span>
    <span class="pl-c1">ok</span>:<span class="pl-smi">string</span><span class="pl-kos">;</span>
    <span class="pl-c1">okToo</span>: <span class="pl-smi">number</span><span class="pl-kos">;</span>
    <span class="pl-c1">notOk</span>:  <span class="pl-s">"o"</span> <span class="pl-c1">|</span> <span class="pl-s">"k"</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">interface</span> <span class="pl-smi">Bar</span> <span class="pl-kos">{</span>
    <span class="pl-c1">bar</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">FooBar</span> <span class="pl-k">extends</span> <span class="pl-smi">Foo</span><span class="pl-kos">,</span> <span class="pl-smi">Bar</span><span class="pl-kos">{</span>
<span class="pl-kos">}</span>

<span class="pl-k">function</span> <span class="pl-en">mix</span><span class="pl-c1">&lt;</span><span class="pl-smi">T</span><span class="pl-c1">&gt;</span><span class="pl-kos">(</span><span class="pl-s1">obj</span>:<span class="pl-smi">T</span><span class="pl-kos">)</span>: <span class="pl-smi">T</span> <span class="pl-c1">&amp;</span> <span class="pl-smi">Bar</span> <span class="pl-kos">{</span>
    <span class="pl-kos">(</span><span class="pl-s1">obj</span> <span class="pl-k">as</span> <span class="pl-smi">any</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-c1">bar</span><span class="pl-c1">=</span><span class="pl-s">"bar"</span><span class="pl-kos">;</span>
    <span class="pl-k">return</span> <span class="pl-s1">obj</span> <span class="pl-k">as</span> <span class="pl-smi">T</span> <span class="pl-c1">&amp;</span> <span class="pl-smi">Bar</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">var</span> <span class="pl-s1">fooBar</span>:<span class="pl-smi">FooBar</span> <span class="pl-c1">=</span> <span class="pl-en">mix</span><span class="pl-kos">(</span><span class="pl-kos">{</span>
    <span class="pl-c1">ok</span>:<span class="pl-s">"ok"</span><span class="pl-kos">,</span>
    <span class="pl-c1">okToo</span>: <span class="pl-c1">42</span><span class="pl-kos">,</span>
    <span class="pl-c1">notOk</span>:<span class="pl-s">"k"</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">The assignment to <code class="notranslate">fooBar</code> should be allowed.</p>
<p dir="auto"><strong>Actual behavior:</strong></p>
<p dir="auto">I get the totally confusing error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Error:(20, 5) TS2322: Type '{ ok: string; notOk: string; } &amp; Bar' is not assignable to type 'FooBar'.
 Type 'Bar' is not assignable to type 'FooBar'.
 Property 'ok' is missing in type 'Bar'."><pre class="notranslate"><code class="notranslate">Error:(20, 5) TS2322: Type '{ ok: string; notOk: string; } &amp; Bar' is not assignable to type 'FooBar'.
 Type 'Bar' is not assignable to type 'FooBar'.
 Property 'ok' is missing in type 'Bar'.
</code></pre></div>
<p dir="auto">The confusing part is that it complains about the first property (<code class="notranslate">ok</code>) and not about <code class="notranslate">notOk</code>.</p>
<p dir="auto">Looking at the error message it seems that the string literal type <code class="notranslate">notOk:"o"|"k"</code> was converted to <code class="notranslate">notOk :string</code>.</p>
<p dir="auto">Therefore when I turn the string literal type to a string (<code class="notranslate">notOk:string</code>) everything is OK....</p>
<p dir="auto">Hint: defining the string literal type as a type does <em>not</em> solve the problem:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="type NotOK =  &quot;o&quot; | &quot;k&quot;;

interface Foo {
    //...
    notOk: NotOK;
}
//..."><pre class="notranslate"><span class="pl-k">type</span> <span class="pl-smi">NotOK</span> <span class="pl-c1">=</span>  <span class="pl-s">"o"</span> <span class="pl-c1">|</span> <span class="pl-s">"k"</span><span class="pl-kos">;</span>

<span class="pl-k">interface</span> <span class="pl-smi">Foo</span> <span class="pl-kos">{</span>
    <span class="pl-c">//...</span>
    <span class="pl-c1">notOk</span>: <span class="pl-smi">NotOK</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>
<span class="pl-c">//...</span></pre></div>
<p dir="auto">Picking up the remainder of <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="137389504" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/7302" data-hovercard-type="issue" data-hovercard-url="/microsoft/TypeScript/issues/7302/hovercard" href="https://github.com/microsoft/TypeScript/issues/7302">#7302</a></p>
<ul dir="auto">
<li>Salsa-supporting work
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="132607945" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/6992" data-hovercard-type="issue" data-hovercard-url="/microsoft/TypeScript/issues/6992/hovercard" href="https://github.com/microsoft/TypeScript/issues/6992">#6992</a> Use smarter type fallbacks in error cases</li>
</ul>
</li>
<li>Suggestions
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="38371438" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/185" data-hovercard-type="issue" data-hovercard-url="/microsoft/TypeScript/issues/185/hovercard" href="https://github.com/microsoft/TypeScript/issues/185">#185</a> Non-nullable: confirm that this is committed?</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="94344571" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/3812" data-hovercard-type="issue" data-hovercard-url="/microsoft/TypeScript/issues/3812/hovercard" href="https://github.com/microsoft/TypeScript/issues/3812">#3812</a> Type guards on property access - done as part of non-nullable?</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="136998431" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/7279" data-hovercard-type="issue" data-hovercard-url="/microsoft/TypeScript/issues/7279/hovercard" href="https://github.com/microsoft/TypeScript/issues/7279">#7279</a> Trailing commas in argument lists</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="135988708" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/7209" data-hovercard-type="issue" data-hovercard-url="/microsoft/TypeScript/issues/7209/hovercard" href="https://github.com/microsoft/TypeScript/issues/7209">#7209</a> Add a "force strict mode" option</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="133517467" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/7077" data-hovercard-type="issue" data-hovercard-url="/microsoft/TypeScript/issues/7077/hovercard" href="https://github.com/microsoft/TypeScript/issues/7077">#7077</a> Duplicate identifiers in namespace emit</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="132840401" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/7011" data-hovercard-type="issue" data-hovercard-url="/microsoft/TypeScript/issues/7011/hovercard" href="https://github.com/microsoft/TypeScript/issues/7011">#7011</a> Apply interface types to provide types to implicit-any-declared class properties</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="130895835" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/6864" data-hovercard-type="issue" data-hovercard-url="/microsoft/TypeScript/issues/6864/hovercard" href="https://github.com/microsoft/TypeScript/issues/6864">#6864</a> Disallow implicitly duplicated <code class="notranslate">enum</code> values</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="40483812" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/471" data-hovercard-type="issue" data-hovercard-url="/microsoft/TypeScript/issues/471/hovercard" href="https://github.com/microsoft/TypeScript/issues/471">#471</a> Permit an implementing class to ignore private methods of the implementee class</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="130023716" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/6758" data-hovercard-type="issue" data-hovercard-url="/microsoft/TypeScript/issues/6758/hovercard" href="https://github.com/microsoft/TypeScript/issues/6758">#6758</a> Allow <code class="notranslate">--name=value</code> commandline switch format</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="136670372" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/7256" data-hovercard-type="issue" data-hovercard-url="/microsoft/TypeScript/issues/7256/hovercard" href="https://github.com/microsoft/TypeScript/issues/7256">#7256</a> Disallow <code class="notranslate">void</code> in truthyness positions</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="133407645" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/7071" data-hovercard-type="issue" data-hovercard-url="/microsoft/TypeScript/issues/7071/hovercard" href="https://github.com/microsoft/TypeScript/issues/7071">#7071</a> <code class="notranslate">require</code> of <code class="notranslate">.json</code> file</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="130527896" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/6808" data-hovercard-type="issue" data-hovercard-url="/microsoft/TypeScript/issues/6808/hovercard" href="https://github.com/microsoft/TypeScript/issues/6808">#6808</a> Start a deprecation path for <code class="notranslate">module</code></li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="94019726" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/3792" data-hovercard-type="issue" data-hovercard-url="/microsoft/TypeScript/issues/3792/hovercard" href="https://github.com/microsoft/TypeScript/issues/3792">#3792</a> Allow <code class="notranslate">export default namespace foo {</code> and other <code class="notranslate">export default</code> combos</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="137981366" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/7347" data-hovercard-type="issue" data-hovercard-url="/microsoft/TypeScript/issues/7347/hovercard" href="https://github.com/microsoft/TypeScript/issues/7347">#7347</a> Allow rest args in non-final positions</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="122029991" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/6094" data-hovercard-type="issue" data-hovercard-url="/microsoft/TypeScript/issues/6094/hovercard" href="https://github.com/microsoft/TypeScript/issues/6094">#6094</a> Provide a way out for incompatible derived class method signatures</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="131259712" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/6895" data-hovercard-type="issue" data-hovercard-url="/microsoft/TypeScript/issues/6895/hovercard" href="https://github.com/microsoft/TypeScript/issues/6895">#6895</a> Outersection types</li>
</ul>
</li>
</ul>