title: How do I return the type of the subclass from the parent?
body: <p>When calling a parent class' <code>new this()</code>, I'm having trouble figuring out how to return the type of the subclass, not the parent class.</p>
  
  <p>In the example below, the code runs without errors, but <code>child.hi()</code> shows up as an error because <code>child</code> has type <code>Parent</code> and not <code>Child</code>.</p>
  
  <pre><code>class Parent {  
    static get() {
      return new this();
    }
  }
  
  class Child extends Parent {
    hi() {
      console.log('hi!');
    }
  
    static make() {
      const child = this.get();
      child.hi(); // &lt;-- type error
    }
  }
  
  Child.make();
  </code></pre>
  
  <p><a href="https://www.typescriptlang.org/play?ssl=18&amp;ssc=14&amp;pln=1&amp;pc=1#code/MYGwhgzhAEAKYCcCmA7ALtA3taAoHEaYaAlsNAOZJoAUAlFvtAJDJoCuCK0KSA7tDQALEhHoBuJgF9cM3KEgwAwiJAATaEgAeaVGpjxk6RjhH0TLYAHsUEKyCQA6EFYo0A5CICE7upJwyOEyExGTQALZgANZI5phMzNa2GMCqGgC8giIQjlS0fkw4qSTqjmYFAbK4uColao6RMRJAA" rel="nofollow noreferrer">Typescript Playground Link</a></p>