title: Typescript equals
body: <p>How do I implement equals in Typescript?<br>
  I've tried a few methods, both didn't work.  </p>
  
  <p>Option 1: </p>
  
  <pre><code>abstract class GTreeObject&lt;T&gt;{ 
      abstract equals(obj: T): boolean; 
  } 
  
  class GNode extends GTreeObject&lt;GNode&gt;{ 
      public equals(obj: GNode){ 
          //Implement 
      } 
  } 
  </code></pre>
  
  <p>Results in: Generic type 'GNode' requires 1 type argument(s).  </p>
  
  <p>Option 2 would involve casting during runtime, but how to do the casting?: </p>
  
  <pre><code>abstract class GTreeObject{ 
      abstract equals(obj: Object): boolean; 
  } 
  
  class GNode extends GTreeObject{ 
      //How to cast Object to GNode?? 
      public equals(obj: Object){ 
          //Implement 
      } 
  } 
  </code></pre>
  
  <p>How to solve reliably? </p>