<p dir="auto">In my JS project I have a few functions that look like this:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="function doSomethingAsync(options) {
    if (!options.someCondition) {
        return Promise.reject('You are missing something');
    }

    return new Promise((resolve, reject) =&gt; {
        // do something async and then resolve or reject
    });
}"><pre class="notranslate"><span class="pl-k">function</span> <span class="pl-en">doSomethingAsync</span><span class="pl-kos">(</span><span class="pl-s1">options</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-c1">!</span><span class="pl-s1">options</span><span class="pl-kos">.</span><span class="pl-c1">someCondition</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-k">return</span> <span class="pl-v">Promise</span><span class="pl-kos">.</span><span class="pl-en">reject</span><span class="pl-kos">(</span><span class="pl-s">'You are missing something'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-kos">}</span>

    <span class="pl-k">return</span> <span class="pl-k">new</span> <span class="pl-v">Promise</span><span class="pl-kos">(</span><span class="pl-kos">(</span><span class="pl-s1">resolve</span><span class="pl-kos">,</span> <span class="pl-s1">reject</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
        <span class="pl-c">// do something async and then resolve or reject</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">This causes every single line inside this function to be underlined in red (which is visually kind of distracting, especially if a function has 50+ lines). I think it would be best to just underline the return statements, instead of every line.</p>
<p dir="auto">I can workaround this by moving the if condition inside the function body of the promise, but I'm wondering if this is really a valid error? I guess the problem here is that the return type of <code class="notranslate">Promise.reject</code> is <code class="notranslate">Promise&lt;void&gt;</code> while <code class="notranslate">new Promise</code> returns <code class="notranslate">Promise&lt;{}&gt;</code> (according to IntelliSense).</p>
<p dir="auto">I figured that this error is coming from TypeScript and not VS Code, but I thought I'd still post it here.</p>
<p dir="auto">See attached screen shot, I have many snippets defined and they are the only entries that show up when I auto complete inside an object literal, which is weird imho:</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/900690/11789872/1c19940e-a299-11e5-9ce8-d36a5289feb3.png"><img width="512" alt="screen shot 2015-12-14 at 19 29 35" src="https://cloud.githubusercontent.com/assets/900690/11789872/1c19940e-a299-11e5-9ce8-d36a5289feb3.png" style="max-width: 100%;"></a></p>