title: casting object and checking if it is instance of casted class
body: <p>I am trying to cast an <code>Object</code> to a class using <code>as</code> keyword but when I check if it is instance of class it returns false. Can someone explain why it is this way and is there any was to cast to the class and check if it is instance of the class ?</p>
  
  <p>Sample code :</p>
  
  <pre><code>class A {
      id: string;
      constructor(id: string) {
          this.id = id
      }
  }
  
  const a = { id: '1' } as A
  const b = new A('1')
  
  console.log(a instanceof A); // false
  console.log(b instanceof A) // true
  </code></pre>