title: How to extend an interface declared in an external library d.ts?
body: <p>I installed the <code>knockout</code> definitions using the documented method like this.</p>
  
  <pre><code>npm install @types/knockout
  </code></pre>
  
  <p>It works nicely, I could import it like this anywhere.</p>
  
  <pre><code>import * as ko from "knockout";
  </code></pre>
  
  <p>However, I'm stuck with extending <code>KnockoutStatic</code> interface with some custom stuff. I'm trying to migrate a <code>&lt;reference ... /&gt;</code> and <code>namespace</code> based huge TS application to use modules. Before, I easily declared the extension interface <em>anywhere</em> and the declarations got merged. Let's say my extension looks like this.</p>
  
  <pre><code>interface KnockoutStatic {
    doSomething(): void;
  }
  </code></pre>
  
  <p>I tried to create a <code>KnockoutExtensions.d.ts</code> file where I declared it like this.</p>
  
  <pre><code>import "knockout";
  
  declare module "knockout" {
    export interface KnockoutStatic {
      doSomething(): void;
    }
  }
  </code></pre>
  
  <p>But when I import both <code>knockout</code> and my extension somewhere, TS still cannot resolve the <code>doSomething</code> calls.</p>
  
  <pre><code>import * as ko from "knockout";
  import "./KnockoutExtensions";
  
  ko.doSomething(); // error
  </code></pre>
  
  <p>What is the proper method of extending library interfaces using TypeScript 2.0 and the new <code>d.ts</code> subsystem?</p>
  
  <p>I'm using Visual Studio 2015 Update 3 with TypeScript 2.0 installed.</p>