title: The right hand side of an arithmetic operation must be of type 'any', 'number' or an enum type
body: <p>I have this code in JS and I need to make it work in TypeScript.<br>
  It keeps saying:</p>
  
  <blockquote>
    <p>The right hand side of an arithmetic operation must be of type 'any', 'number' or an enum type</p>
  </blockquote>
  
  <pre><code>sort(field, reverse, primer) {  
      var key = primer ? 
      function(x) {return primer(x[field])} : 
      function(x) {return x[field]};
  
      reverse = [-1, 1][+!!reverse];
  
      return function (a, b) {
          return a = key(a), b = key(b), reverse * ((a &gt; b)) - (b &gt; a));
      } 
  }
  </code></pre>
  
  <p>Any ideas?</p>