title: TypeScript Boolean XOR -- error TS2113: The left/right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type
body: <p>I have the following code:</p>
  
  <pre><code>var a: boolean = ...;
  var b: boolean = ...;
  
  if (a ^ b) { // this line gives error
    // ...
  }
  </code></pre>
  
  <p>However, the TypeScript compiler is giving an error:</p>
  
  <blockquote>
    <p>error TS2113: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.</p>
  </blockquote>
  
  <p>Is it because bitwise operators only work for number? The code runs perfectly fine if written directly in JavaScript.</p>
  
  <p>Is there any alternatives other than <code>if (a ? !b : a) { ... }</code>?</p>
  
  <p><strong>Update</strong>
  Given that both of them are boolean, I could just use <code>a !== b</code></p>