title: Is there a difference in the Promise type returned by an ordinary function and an async function?
body: <p>Let's say I have a Typescript project with the following (latest) packages:</p>
  
  <ul>
  <li>q@1.5.0</li>
  <li>typescript@2.5.2</li>
  <li>@types/q@1.0.5</li>
  </ul>
  
  <p>Now let's say in my project I define a function that returns a Promise (as defined by Typescript's native ambient declarations):</p>
  
  <pre class="lang-js prettyprint-override"><code>import * as q from "q";
  
  function doSomethingElseAsync(): Promise&lt;number&gt; {
      return q.Promise&lt;number&gt;((resolve, reject) =&gt; {
          setTimeout(() =&gt; resolve(1), 5000);
      });
  }
  </code></pre>
  
  <p>When compiling, Typescript complains with the following error:</p>
  
  <pre class="lang-none prettyprint-override"><code>error TS2322: Type 'Q.Promise&lt;number&gt;' is not assignable to type 'Promise&lt;number&gt;'.
    Types of property 'then' are incompatible.
      Type '&lt;U&gt;(onFulfill?: ((value: number) =&gt; IWhenable&lt;U&gt;) | undefined, onReject?: ((error: any) =&gt; IWhena...' is not assignable to type '&lt;TResult1 = number, TResult2 = never&gt;(onfulfilled?: ((value: number) =&gt; TResult1 | PromiseLike&lt;TR...'.
        Types of parameters 'onFulfill' and 'onfulfilled' are incompatible.
          Type '((value: number) =&gt; TResult1 | PromiseLike&lt;TResult1&gt;) | null | undefined' is not assignable to type '((value: number) =&gt; IWhenable&lt;TResult1 | TResult2&gt;) | undefined'.
            Type 'null' is not assignable to type '((value: number) =&gt; IWhenable&lt;TResult1 | TResult2&gt;) | undefined'.
  </code></pre>
  
  <p>For a while, I thought it was because Q Promises just weren't compatible with Typescript's native declarations. However, if I add the <code>async</code> keyword to the function definition, the error disappears entirely.</p>
  
  <p>I'm rather mystified by this behavior. Is this a bug in Typescript, Q, or the Q typings? Or is this some esoteric but expected behavior of the compiler?</p>