title: Javascript equals === not working as expected
body: <p>I am using Ionic2 and Typescript to develop an app.  </p>
  
  <p>I have the following code:</p>
  
  <pre><code>  public showTick(message: Message): boolean {
        console.log('showTick: '+message+'  '+message.readByReceiver+'  '+this.senderId+'   '+message.senderId);
      if (message &amp;&amp; message.readByReceiver === true &amp;&amp; this.senderId &amp;&amp; this.senderId === message.senderId) {
        console.log('showTick(' + message.content + '): return true');
        return true;
      }
      return false;
    }
  </code></pre>
  
  <p>It outputs the following:</p>
  
  <blockquote>
  <pre><code>showTick: [object Object]  true  P8   P8
  </code></pre>
  </blockquote>
  
  <p>I would have expected it to get inside the <code>if</code> statement and also print:</p>
  
  <blockquote>
  <pre><code>showTick(xxx): return true
  </code></pre>
  </blockquote>
  
  <p>Is there something wrong with my use of <code>===</code>?</p>
  
  <p>Any advise appreciated.</p>
  
  <p>p.s. This is the <code>Message</code> model:</p>
  
  <pre><code>  interface Message {
      _id?: string;
      chatId?: string;
      senderId?: string;
      ownership?: string;
      content?: string;
      createdAt?: Date;
      changeDate?: boolean;
      readByReceiver?: boolean;
    }
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I change the code to:</p>
  
  <pre><code>  public showTick(message: Message): boolean {
      console.log('showTick: ', message, message.readByReceiver, this.senderId, message.senderId);
      if (message) {
      console.log('showTick1 ');
        if (message.readByReceiver === true || message.readByReceiver === 'true') {
      console.log('showTick2 ');
          if (this.senderId) {
      console.log('showTick3 ');
            if (this.senderId === message.senderId) {
              console.log('showTick(' + message.content + '): return true');
              return true;
            }
          }
        }
      }
      return false;
    }
  </code></pre>
  
  <p>And get the following ts error (<code>message.readByReceiver === 'true'</code>):</p>
  
  <blockquote>
  <pre><code>ERROR in ./app/pages/messages/messages.ts
  (275,46): error TS2365: Operator '===' cannot be applied to types 'boolean' and 'string'.
  </code></pre>
  </blockquote>
  
  <p><strong>UPDATE</strong></p>
  
  <p>The problem seems to be that a <code>boolean</code> type object is holding a <code>string</code>, so the following fixes it.</p>
  
  <pre><code>if (message.readByReceiver === true || message.readByReceiver+'' === 'true') 
  </code></pre>
  
  <p>Two issues:</p>
  
  <ol>
  <li>This fix seems like a hack to me. </li>
  <li>I am not sure why the <code>boolean</code> is holding a <code>string</code>. This is an
  object coming from a Meteor database defined as <code>boolean</code>.</li>
  </ol>