title: Wrong type with sort in Typescript
body: <pre><code>var cheapest = leaves.sort((a,b) =&gt; &lt;boolean&gt;(&lt;number&gt;a.cost &lt; &lt;number&gt;b.cost));
  //also tried without casting
  </code></pre>
  
  <p>Gives me the following error:</p>
  
  <pre><code>'Error'
  message: 'Argument of type '(a: any, b: any) =&gt; boolean' is not assignable to parameter of type '(a: any, b: any) =&gt; number'.
  Type 'boolean' is not assignable to type 'number'.'
  </code></pre>
  
  <p>How should i fix this?</p>
  
  <p>Edit:
  The js code ( original) is taken from : 
  <a href="https://github.com/atomicptr/goap/blob/gh-pages/gameplay/ai/planner.js" rel="noreferrer">https://github.com/atomicptr/goap/blob/gh-pages/gameplay/ai/planner.js</a> , which indeed seems to sort by bool instead of number.</p>