title: Overwrite/override method signature in TypeScript interface
body: <p>In this particular example, I'm extending the <code>Array&lt;T&gt;</code> interface like so:</p>
  
  <pre><code>interface BetterArray&lt;T&gt; extends Array&lt;T&gt; {
      push(this: BetterArray&lt;T&gt;, value: T): this;
  }
  </code></pre>
  
  <p><em>Note for reference - <code>Array&lt;T&gt;.push</code> is implemented like this</em></p>
  
  <pre><code>interface Array&lt;T&gt; {
      push(...items: T[]): number;
  }
  </code></pre>
  
  <p>But I get the following compile-time error:</p>
  
  <blockquote>
    <p>Interface 'BetterArray' incorrectly extends interface 'T[]'.<br>
    Types of property 'push' are incompatible.
        Type '(this: BetterArray, value: T) => this' is not assignable to type '(...items: T[]) => number'.
          Type 'this' is not assignable to type 'number'.
            Type 'BetterArray' is not assignable to type 'number'.</p>
  </blockquote>
  
  <p>Is there any way I can forcibly instruct TypeScript that I want to overwrite push on my interface <em>(like <a href="https://msdn.microsoft.com/en-us/library/435f1dw2.aspx" rel="noreferrer">member hiding in C#</a>)</em>?</p>
  
  <p><strong>Note - I'm using TypeScript 2.0</strong></p>
  
  <p>Further reading - it appears that this is purely down to return type - basically I want to enforce by interface, a new return type...</p>
  
  <pre><code>interface A {
      fn(): number;
  }
  
  interface B extends A {
      fn(): this;
  }
  </code></pre>
  
  <blockquote>
    <p>Interface 'B' incorrectly extends interface 'A'.   Types of property
    'fn' are incompatible.
        Type '() => this' is not assignable to type '() => number'.
          Type 'this' is not assignable to type 'number'.
            Type 'B' is not assignable to type 'number'.</p>
  </blockquote>