<p dir="auto"><strong>TypeScript Version:</strong></p>
<p dir="auto">nightly (1.9.0-dev.20160522-1.0)</p>
<p dir="auto"><strong>Description</strong></p>
<p dir="auto">I'm trying to add a reference from the root:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import {Hero} from &quot;/models/hero&quot;;"><pre class="notranslate"><code class="notranslate">import {Hero} from "/models/hero";
</code></pre></div>
<p dir="auto">But it only works if I add both <code class="notranslate">models</code> and <code class="notranslate">/models</code> to the rootDirs array:</p>
<p dir="auto">tsconfig.json</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    &quot;rootDirs&quot;: [
      &quot;models&quot;,
      &quot;/models&quot;
    ]
"><pre class="notranslate"><code class="notranslate">    "rootDirs": [
      "models",
      "/models"
    ]

</code></pre></div>
<p dir="auto">If I only use one (either one) I get <code class="notranslate">error TS2307: Cannot find module '/models/hero'</code></p>
<p dir="auto">Seems odd that I need both for it to work.</p>
<p dir="auto"><strong>TypeScript Version:</strong></p>
<p dir="auto">nightly (1.9.0-dev.20160217)</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="let greeting:string;
let x = (message: string | number) =&gt; {
        if (typeof message !== &quot;string&quot;) {
            return;
        }
        // It's obvious, that message must be a string now. It works with &quot;else statement&quot; but not with early return.
        greeting = message;
    }
}"><pre class="notranslate"><span class="pl-k">let</span> <span class="pl-s1">greeting</span>:<span class="pl-smi">string</span><span class="pl-kos">;</span>
<span class="pl-k">let</span> <span class="pl-en">x</span> <span class="pl-c1">=</span> <span class="pl-kos">(</span><span class="pl-s1">message</span>: <span class="pl-smi">string</span> <span class="pl-c1">|</span> <span class="pl-smi">number</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
        <span class="pl-k">if</span> <span class="pl-kos">(</span><span class="pl-k">typeof</span> <span class="pl-s1">message</span> <span class="pl-c1">!==</span> <span class="pl-s">"string"</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
            <span class="pl-k">return</span><span class="pl-kos">;</span>
        <span class="pl-kos">}</span>
        <span class="pl-c">// It's obvious, that message must be a string now. It works with "else statement" but not with early return.</span>
        <span class="pl-s1">greeting</span> <span class="pl-c1">=</span> <span class="pl-s1">message</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 raising error.</p>
<p dir="auto"><strong>Actual behavior:</strong><br>
Compiler raises an error that type string | number cannot be assigned to string variable.</p>