title: Why I can't compare boolean to boolean in JavaScript React using Flow?
body: <p>Hello I'm working with <a href="https://flow.org" rel="nofollow noreferrer">Flow</a> to type checking my JavaScript code. 
  My state for the following app looks like this:</p>
  
  <pre><code>type State = {
    todos: Array&lt;{text: string, date: Object, completed: boolean}&gt;,
  };
  </code></pre>
  
  <p>After hit the command <em>flow start</em> I've got this error message: Cannot compare boolean to boolean.</p>
  
  <p>The error message occurs at the following code snippet. There I toggle a todo item and I sort the list with a compare function.</p>
  
  <pre><code>this.setState(prevState =&gt; ({todos: t.sort(function(a,b) {
    return a.completed === b.completed ? 0 : a.completed &gt; b.completed ? -1 : a.completed &lt; b.completed ? 1 : 0
  })}));
  </code></pre>