title: Async function not allowing return type of two promise types in typescript
body: <p>node 14.7.0, npm 6.14.7, typescript 3.7.3.</p>
  <p>I have a method that queries a postgres database and, depending on a param, will return the first row it finds or the entire result from the query. Similar to this:</p>
  <pre><code>async getRecord(options: {singleRow: boolean}): Promise&lt;QueryResult&gt; | Promise&lt;Record&gt; {
      const result:QueryResult = await postgres.query(...);
      
      if (options &amp;&amp; options.singlerow) {
          return result.rows[0];
      }
  
      return result;
  }
  </code></pre>
  <p>However, I receive the following error: <code>The return type of an async function or method must be the global Promise&lt;T&gt; type.</code> I do not receive an error when I remove the <code>| Promise&lt;Record&gt;</code> section, even though the first return (in the if statement) returns a <code>Promise&lt;Record&gt;</code>. What should I do to fix this?</p>