title: Typescript conversion to boolean
body: <p>In Typescript I can do this:</p>
  
  <pre><code>var xxx : some_type;
  
  if (xxx)
      foo();
  else
      bar();
  </code></pre>
  
  <p>Here xxx will be treated as a boolean, regardless of its type.</p>
  
  <p>I would like to do the same thing in a function argument. I have this function:</p>
  
  <pre><code>function foo(b : boolean) { ... }
  </code></pre>
  
  <p>I want to be able to call <code>foo(xxx)</code> and have xxx treated as a boolean, regardless of its type. But Typescript won't allow that.</p>
  
  <p>I tried this:</p>
  
  <pre><code>foo(&lt;boolean&gt;xxx);
  </code></pre>
  
  <p>but that Typescript won't allow that either.</p>
  
  <p>I can do this:</p>
  
  <pre><code>foo(xxx ? true : false);
  </code></pre>
  
  <p>But that seems a bit silly. Is there a better way to do it?</p>