<p dir="auto"><code class="notranslate">str</code> has been asserted it cannot be <code class="notranslate">undefined</code> on all call sites of <code class="notranslate">test()</code> below:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="let str: string | undefined;
if (str) {
    test();
}

function test() {
    str.charAt(1); // error can be undefined
}"><pre class="notranslate"><span class="pl-k">let</span> <span class="pl-s1">str</span>: <span class="pl-smi">string</span> <span class="pl-c1">|</span> <span class="pl-c1">undefined</span><span class="pl-kos">;</span>
<span class="pl-k">if</span> <span class="pl-kos">(</span><span class="pl-s1">str</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-en">test</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">function</span> <span class="pl-en">test</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-s1">str</span><span class="pl-kos">.</span><span class="pl-en">charAt</span><span class="pl-kos">(</span><span class="pl-c1">1</span><span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-c">// error can be undefined</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">Hi,</p>
<p dir="auto"><strong>Version</strong>: 1.8.5</p>
<p dir="auto">I would like to see an error when duplicate values are found in a string literal declaration:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="
type alphabet = 'a' | ... | 'x' | 'y' | 'a';  // Error: Duplicate value 'a'
"><pre class="notranslate"><span class="pl-k">type</span> <span class="pl-smi">alphabet</span> <span class="pl-c1">=</span> <span class="pl-s">'a'</span> <span class="pl-c1">|</span> ... <span class="pl-c1">|</span> <span class="pl-s">'x'</span> <span class="pl-c1">|</span> <span class="pl-s">'y'</span> <span class="pl-c1">|</span> <span class="pl-s">'a'</span><span class="pl-kos">;</span>  <span class="pl-c">// Error: Duplicate value 'a'</span></pre></div>
<p dir="auto">This is most likely an unintentional inclusion.</p>