title: How to extend native JavaScript types in TypeScript 1.8 using global augmentation?
body: <p>I'm trying to extend the native JavaScript types using the new global augmentation in TypeScript 1.8 as described <a href="http://www.typescriptlang.org/docs/release-notes/typescript-1.8.html" rel="nofollow">here</a>. I am however experiencing problems when the extension functions returns the same type.</p>
  
  <p><strong>Global.ts</strong></p>
  
  <pre><code>export {};
  declare global {
      interface Date {
          Copy(): Date;
      }
  }
  
  if (!Date.prototype.Copy) {
      Date.prototype.Copy = function () {
          return new Date(this.valueOf());
      };
  }
  </code></pre>
  
  <p><strong>DateHelper.ts</strong></p>
  
  <pre><code>export class DateHelper {
      public static CopyDate(date: Date): Date {
          return date.Copy();
      }
  }
  </code></pre>
  
  <p>I'm experiencing the following error TS2322 when trying to use the defined extension in DateHelper.ts:</p>
  
  <pre><code>Type 'Date' is not assignable to type 'Date'.
  Property 'toDateString' is missing in type 'Date'.
  </code></pre>
  
  <p>Does anybody know how to resolve this issue?</p>