title: Typescript if condition with boolean not working properly
body: <p>There is something strange going on and I really don't know why.<br>
  In my angular project I have a component which has a child-component. The parent component's html is like this:</p>
  
  <pre><code>&lt;child-component [isEditable]="isEditable"&gt;&lt;/child-component&gt;
  </code></pre>
  
  <p>In parent component ts I declared the property "isEditable" :</p>
  
  <pre><code>isEditable: boolean = true;
  </code></pre>
  
  <p>and then in ngOnInit:</p>
  
  <pre><code>this.isEditable = false;
  </code></pre>
  
  <p>Then in child component I have the correspondent input property with default value:</p>
  
  <pre><code>@Input() isEditable: boolean = true;
  </code></pre>
  
  <p>When this value changes to false from the parent, I need to implement some logic. The problem is that both in ngOnInit and ngOnChanges of the child component, if I do </p>
  
  <pre><code>if(!this.isEditable) {
     console.log("DO SOMETHING");
  } 
  </code></pre>
  
  <p>It doesn't enter the condition. So I thought about some "delay" in receiving the new value, added a console.log before the if condition but it turned out it was correctly <em>false</em>.<br>
  I ended up doing this in ngOnInit method:</p>
  
  <pre><code>console.log("BEFORE IF", this.isEditable);
  if(this.isEditable){
     console.log("ENTERED IN TRUE", this.isEditable);
  }
  </code></pre>
  
  <p>and this is the output:</p>
  
  <p><a href="https://i.stack.imgur.com/Lob8R.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Lob8R.png" alt="enter image description here"></a></p>
  
  <p>I really don't get what's wrong. The property is false as it should be but it enters the condition with true. I'm sure it's something stupid but I don't get it...</p>