<p dir="auto"><strong>TypeScript Version:</strong> nightly (1.9.0-dev.20160521) (same behavior in 1.8.10).</p>
<p dir="auto">Given this plain JavaScript file annotated with JSDoc for the Closure Compiler (included via <code class="notranslate">allowJs</code>):</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="/**
 * @param {number=} input
 * @return {number}
 */
function legacyMethod(input) {
    if (typeof input === &quot;undefined&quot;) {
        return 0;
    }
    return input * input;
};"><pre class="notranslate"><span class="pl-c">/**</span>
<span class="pl-c"> * <span class="pl-k">@param</span> {<span class="pl-smi">number=</span>} input</span>
<span class="pl-c"> * <span class="pl-k">@return</span> {<span class="pl-smi">number</span>}</span>
<span class="pl-c"> */</span>
<span class="pl-k">function</span> <span class="pl-en">legacyMethod</span><span class="pl-kos">(</span><span class="pl-s1">input</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-k">typeof</span> <span class="pl-s1">input</span> <span class="pl-c1">===</span> <span class="pl-s">"undefined"</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-k">return</span> <span class="pl-c1">0</span><span class="pl-kos">;</span>
    <span class="pl-kos">}</span>
    <span class="pl-k">return</span> <span class="pl-s1">input</span> <span class="pl-c1">*</span> <span class="pl-s1">input</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">And this TypeScript file:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="console.log(legacyMethod(1));
console.log(legacyMethod());"><pre class="notranslate"><span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-en">legacyMethod</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-kos">;</span>
<span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-en">legacyMethod</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">I would expect that the second <code class="notranslate">legacyMethod</code> call to also be fine, due to the <code class="notranslate">=</code> suffix on the type (see <a href="https://developers.google.com/closure/compiler/docs/js-for-compiler#types" rel="nofollow">https://developers.google.com/closure/compiler/docs/js-for-compiler#types</a> for more details on the Closure Compiler type language). Based on Visual Studio Code's Intellisense the extracted type for <code class="notranslate">legacyMethod</code> is <code class="notranslate">function legacyMethod(input?: number): number</code> which seems correct. However, when running, I get:</p>
<p dir="auto"><code class="notranslate">main.ts(2,13): error TS2346: Supplied parameters do not match any signature of call target.</code></p>
<p dir="auto">Out of curiosity, I tried <code class="notranslate">legacyMethod(undefined)</code> which worked (as did <code class="notranslate">legacyMethod(null)</code>, which the Closure Compiler would not have allowed, since optional parameters are undefined, not null).</p>
<p dir="auto">When I use jsdoc to create constructor the intellisense work well. Except a bug that it must obey parameter. It will not know type if the parameter is not all passed in. even it marked as optional by jsdoc</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/1042507/12939084/240cda72-cfee-11e5-8a05-f8eef6b9cb8c.png"><img src="https://cloud.githubusercontent.com/assets/1042507/12939084/240cda72-cfee-11e5-8a05-f8eef6b9cb8c.png" alt="screen shot 2559-02-10 at 12 02 13 pm" style="max-width: 100%;"></a></p>
<p dir="auto">As the screenshot. air is optional by jsdoc</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/1042507/12939086/2bf5250a-cfee-11e5-9b1b-0bae6381420c.png"><img src="https://cloud.githubusercontent.com/assets/1042507/12939086/2bf5250a-cfee-11e5-9b1b-0bae6381420c.png" alt="screen shot 2559-02-10 at 11 56 43 am" style="max-width: 100%;"></a></p>
<p dir="auto">this work but</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/1042507/12939089/325376ae-cfee-11e5-986f-a1e3f52ee421.png"><img src="https://cloud.githubusercontent.com/assets/1042507/12939089/325376ae-cfee-11e5-986f-a1e3f52ee421.png" alt="screen shot 2559-02-10 at 11 54 19 am" style="max-width: 100%;"></a></p>
<p dir="auto">not</p>