<p dir="auto">define function with JSDoc which contain callback function as parameter get error about duplicate</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/1042507/13346825/bb473dba-dc9b-11e5-8d3f-58618be8c815.png"><img src="https://cloud.githubusercontent.com/assets/1042507/13346825/bb473dba-dc9b-11e5-8d3f-58618be8c815.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto"><strong>TypeScript Version:</strong></p>
<p dir="auto">nightly (1.9.0-dev.20160429)</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 maybeNumber: number | undefined;
(function () {
    maybeNumber = 1;
})();
if (maybeNumber !== undefined) {
    maybeNumber++;
}"><pre class="notranslate"><span class="pl-k">let</span> <span class="pl-s1">maybeNumber</span>: <span class="pl-smi">number</span> <span class="pl-c1">|</span> <span class="pl-c1">undefined</span><span class="pl-kos">;</span>
<span class="pl-kos">(</span><span class="pl-k">function</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-s1">maybeNumber</span> <span class="pl-c1">=</span> <span class="pl-c1">1</span><span class="pl-kos">;</span>
<span class="pl-kos">}</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">if</span> <span class="pl-kos">(</span><span class="pl-s1">maybeNumber</span> <span class="pl-c1">!==</span> <span class="pl-c1">undefined</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-s1">maybeNumber</span><span class="pl-c1">++</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto"><strong>Expected behavior:</strong><br>
Everything works without errors, <code class="notranslate">maybeNumber</code> preserves type of <code class="notranslate">number | undefined</code> and refines to <code class="notranslate">number</code> in the <code class="notranslate">if</code> block.</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="let maybeNumber: number | undefined;
// Control flow figured that: maybeNumber === undefined
(function () {
    maybeNumber = 1;
})(); // --&gt; oops, unknown side effects
// Revert maybeNumber to initial `number | undefined` to cover all possibilities
if (maybeNumber) {
    // Control flow: can refine to `number` again here
    maybeNumber++;
}"><pre class="notranslate"><span class="pl-k">let</span> <span class="pl-s1">maybeNumber</span>: <span class="pl-smi">number</span> <span class="pl-c1">|</span> <span class="pl-c1">undefined</span><span class="pl-kos">;</span>
<span class="pl-c">// Control flow figured that: maybeNumber === undefined</span>
<span class="pl-kos">(</span><span class="pl-k">function</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-s1">maybeNumber</span> <span class="pl-c1">=</span> <span class="pl-c1">1</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-c">// --&gt; oops, unknown side effects</span>
<span class="pl-c">// Revert maybeNumber to initial `number | undefined` to cover all possibilities</span>
<span class="pl-k">if</span> <span class="pl-kos">(</span><span class="pl-s1">maybeNumber</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-c">// Control flow: can refine to `number` again here</span>
    <span class="pl-s1">maybeNumber</span><span class="pl-c1">++</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto"><strong>Actual behavior:</strong><br>
Language service reports type <code class="notranslate">nothing</code> on <code class="notranslate">maybeNumber</code> after the call (even though it's <code class="notranslate">number | undefined</code> before the call), so statement inside of the <code class="notranslate">if</code> condition breaks.</p>