title: Add a method to an existing class in typescript?
body: <p>I am working in an angular 2 cli project in which I have to create a definition of a plugin, because it doesn't exists its typed. This plugin depends of a main library that has already its own typed and it works.</p>
  
  <p>Anyway,
  I have two files
  the main one with</p>
  
  <p>LIBRARY TYPES FILE A</p>
  
  <pre><code>export class A extends B {
      constructor(...);
      methodX(): void;
  }
  </code></pre>
  
  <p>And I would need to add a new method for my plugin so my class would be like</p>
  
  <pre><code>export class A extends B {
          constructor(...);
          methodX(): void;
          methodY(): void;
      }
  </code></pre>
  
  <p>The point is that I need to add it in a separate file. The problem is adding a method to an existent class without creating a new one</p>
  
  <p>If I put </p>
  
  <p>PLUGIN TYPES FILE B</p>
  
  <pre><code>export class A extends B {
      constructor(...);
      methodX(): void;
  }
  </code></pre>
  
  <p>or </p>
  
  <p>PLUGIN TYPES FILE B</p>
  
  <pre><code>export class A extends B {
          constructor(...);
          methodX(): void;
          methodY(): void;
  }
  </code></pre>
  
  <p>It doesn't work, does anyone how can I achieve overwriting a class or extending it with a new method that?</p>
  
  <p>Thanks</p>