<p dir="auto"><strong>TypeScript Version:</strong></p>
<p dir="auto">typescript@1.9.0-dev.20160409</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="export enum SMTypeEnum { // расположены в порядке возрастания приоритета
  S, I
}
type SMItemType = { messageType: SMTypeEnum, description: string, cssClassSuffix: string}
export var S_M_TYPES: SMItemType[] = [
  {messageType: SMTypeEnum.S, description: &quot;Success&quot;, cssClassSuffix: &quot;success&quot;}, // type: &quot;S&quot;
  {messageType: SMTypeEnum.I, description: &quot;Info&quot;, cssClassSuffix: &quot;info&quot;}, // type: &quot;I&quot;
];

.....

for (var apm of this.afterPostMessages) {
  this.maxMessageType = Math.max(this.maxMessageType, SMTypeEnum[apm.msgType]);
}
"><pre class="notranslate"><span class="pl-k">export</span> <span class="pl-k">enum</span> <span class="pl-smi">SMTypeEnum</span> <span class="pl-kos">{</span> <span class="pl-c">// расположены в порядке возрастания приоритета</span>
  <span class="pl-c1">S</span><span class="pl-kos">,</span> <span class="pl-c1">I</span>
<span class="pl-kos">}</span>
<span class="pl-k">type</span> <span class="pl-smi">SMItemType</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span> <span class="pl-c1">messageType</span>: <span class="pl-smi">SMTypeEnum</span><span class="pl-kos">,</span> <span class="pl-c1">description</span>: <span class="pl-smi">string</span><span class="pl-kos">,</span> <span class="pl-c1">cssClassSuffix</span>: <span class="pl-smi">string</span><span class="pl-kos">}</span>
<span class="pl-k">export</span> <span class="pl-k">var</span> <span class="pl-smi">S_M_TYPES</span>: <span class="pl-smi">SMItemType</span><span class="pl-kos">[</span><span class="pl-kos">]</span> <span class="pl-c1">=</span> <span class="pl-kos">[</span>
  <span class="pl-kos">{</span><span class="pl-c1">messageType</span>: <span class="pl-smi">SMTypeEnum</span><span class="pl-kos">.</span><span class="pl-c1">S</span><span class="pl-kos">,</span> <span class="pl-c1">description</span>: <span class="pl-s">"Success"</span><span class="pl-kos">,</span> <span class="pl-c1">cssClassSuffix</span>: <span class="pl-s">"success"</span><span class="pl-kos">}</span><span class="pl-kos">,</span> <span class="pl-c">// type: "S"</span>
  <span class="pl-kos">{</span><span class="pl-c1">messageType</span>: <span class="pl-smi">SMTypeEnum</span><span class="pl-kos">.</span><span class="pl-c1">I</span><span class="pl-kos">,</span> <span class="pl-c1">description</span>: <span class="pl-s">"Info"</span><span class="pl-kos">,</span> <span class="pl-c1">cssClassSuffix</span>: <span class="pl-s">"info"</span><span class="pl-kos">}</span><span class="pl-kos">,</span> <span class="pl-c">// type: "I"</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">for</span> <span class="pl-kos">(</span><span class="pl-k">var</span> <span class="pl-s1">apm</span> <span class="pl-k">of</span> <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">afterPostMessages</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">maxMessageType</span> <span class="pl-c1">=</span> <span class="pl-smi">Math</span><span class="pl-kos">.</span><span class="pl-en">max</span><span class="pl-kos">(</span><span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">maxMessageType</span><span class="pl-kos">,</span> <span class="pl-smi">SMTypeEnum</span><span class="pl-kos">[</span><span class="pl-s1">apm</span><span class="pl-kos">.</span><span class="pl-c1">msgType</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"><strong>Expected behavior:</strong><br>
no error<br>
<strong>Actual behavior:</strong></p>
<p dir="auto">error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="
interface A&lt;a&gt; {
    brand: 'a';
    nested: a;
}

interface B&lt;a&gt; {
    brand: 'b';
    nested: a;
}

type C&lt;a&gt; = A&lt;a&gt; | B&lt;a&gt;;

type D = C&lt;D&gt; | string; // &lt;-- i wish
"><pre class="notranslate"><span class="pl-k">interface</span> <span class="pl-smi">A</span><span class="pl-c1">&lt;</span><span class="pl-smi">a</span><span class="pl-c1">&gt;</span> <span class="pl-kos">{</span>
    <span class="pl-c1">brand</span>: <span class="pl-s">'a'</span><span class="pl-kos">;</span>
    <span class="pl-c1">nested</span>: <span class="pl-smi">a</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">&lt;</span><span class="pl-smi">a</span><span class="pl-c1">&gt;</span> <span class="pl-kos">{</span>
    <span class="pl-c1">brand</span>: <span class="pl-s">'b'</span><span class="pl-kos">;</span>
    <span class="pl-c1">nested</span>: <span class="pl-smi">a</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">type</span> <span class="pl-smi">C</span><span class="pl-c1">&lt;</span><span class="pl-smi">a</span><span class="pl-c1">&gt;</span> <span class="pl-c1">=</span> <span class="pl-smi">A</span><span class="pl-kos">&lt;</span><span class="pl-smi">a</span><span class="pl-kos">&gt;</span> <span class="pl-c1">|</span> <span class="pl-smi">B</span><span class="pl-kos">&lt;</span><span class="pl-smi">a</span><span class="pl-kos">&gt;</span><span class="pl-kos">;</span>

<span class="pl-k">type</span> <span class="pl-smi">D</span> <span class="pl-c1">=</span> <span class="pl-smi">C</span><span class="pl-kos">&lt;</span><span class="pl-smi">D</span><span class="pl-kos">&gt;</span> <span class="pl-c1">|</span> <span class="pl-smi">string</span><span class="pl-kos">;</span> <span class="pl-c">// &lt;-- i wish</span></pre></div>