title: Why does the Promise generic type only declare the success resolution type?
body: <p>Say I have the following code:</p>
  <pre class="lang-js prettyprint-override"><code>function fn(): Promise&lt;string&gt; {
    return new Promise((resolve, reject) =&gt; {
      let randomBit = (Math.random() * 10) % 2 === 0;
  
      if (randomBit) {
        resolve(&quot;Resolve&quot;);
      } else {
        reject(0);
      }
    });
  }
  </code></pre>
  <p>The above method, which returns a valid Promise, is correctly typed as <code>Promise&lt;string&gt;</code>. I understand that the internal type declares the type returned in the case of a successful resolution. But, what about the return of a rejection? In my example the rejection would resolve to <code>number</code>. Shouldn't, the return signature of <code>fn()</code> be something like</p>
  <pre><code>Promise&lt;string, number&gt;
  </code></pre>
  <p>?</p>
  <p>Or, more generally, shouldn't a Promise declare the generic types for the two possible outcomes, like</p>
  <pre><code>Promise&lt;TSuccess, TError&gt;
  </code></pre>
  <p>?</p>
  <p>I feel like I'm missing something.</p>