title: Use types (interfaces) from other commonjs modules in Visual Studio using TypeScript without having to import that module?
body: <p>I'm trying to simply use types (interfaces) from other commonjs modules. I'm wondering if there is a way to do this without having to import the module each time I need just the types (no implementation)?</p>
  
  <p>Also to the same point. How would I use commonjs declared module types in projects without compiling with "--module commonjs"? (just to use the types, I'm aware you could do <code>var x = require('x')</code> if you don't care about type safety, but that defeats the purpose of TypeScript)</p>
  
  <p>This seems like a valid use case as one could desire to create a library free from the actual implementation... But as I currently see it, you have to <code>import x = require('x')</code> on the actual implementation, even if I don't need it and already have the definition file. </p>
  
  <p>Is there a way to tell the compiler that it "just exists," similar to how declare works with variables?</p>
  
  <p>Example:</p>
  
  <p>Suppose I have file.ts that I'm not compiling with any module setting (none):</p>
  
  <pre><code>/// &lt;reference path="ExternalCommonJSModule.d.ts" /&gt;
  
  export class A {
  
     public foo(bar: ITypeFromExternalCommonJSModule): number {
          return bar.x * 2;
     }
  
  }
  </code></pre>
  
  <p>And suppose ExternalCommonJSModule.d.ts looks like this:</p>
  
  <pre><code>declare module "ExternalCommonJSModule" {
  
       export interface ITypeFromExternalCommonJSModule {
            x: number;
       }
  
  }
  </code></pre>
  
  <p>(note, this <strong>doesn't</strong> compile because file.ts isn't compiled with --module commonjs and it doesn't import the implementation of the .d.ts)</p>