title: Override the property type of a parent class property
body: <p>In the code snippet, I override the foo property of type Parent with a new object of type Child which is a child class of Parent. Am I supposed to do this at all?</p>
  <p>When I am constructing the foo property in the AnotherChild class, this.foo is of type Parent before the Child object is created. After the Child object is created, the type of this.foo changes to Child. I am not sure if this is a good practice.</p>
  <pre><code>class Parent {
    constructor(public x, public y){}
  }
  
  class Child extends Parent {}
  
  class AnotherParent {
    public foo: Parent;
    constructor() {
      this.foo = new Parent(1,2);
    }
  }
  
  class AnotherChild extends anotherParent {
    public foo: Child;
    super();
    this.foo = new Child(this.foo.x, this.foo.y);
  }
  </code></pre>