title: TypeScript: compiling removes unreferenced imports
body: <p>In our project we're using RequireJS as our module loader. Some of our modules will influence global libraries, and hence won't be directly used within the module they are referenced in.</p>
  
  <p>Example:</p>
  
  <pre><code>define(['definitely/goingto/usethis/','just/referencingthis/forpackaging'], function(useThis) {
      useThis.likeIPromised();
  
      // the following call can only be made when the second required file is available
      someGlobalAvailableVariable.someMethod();
  });
  </code></pre>
  
  <p>This works as expected when writing my modules in JavaScript. However, we're translating our project step by step to TypeScript. Given the example above, this results in:</p>
  
  <pre><code>import useThis = module("definitely/goingto/usethis/");
  import whatever = module("just/referencingthis/forpackaging");
  
  useThis.likeIPromised();
  
  // I've written a definition file so the following statement will evaluate
  someGlobalAvailableVariable.someMethod();
  </code></pre>
  
  <p>And when compiling this to JavaScript, <strong>the compiler wants to be helpful and removes any unused imports</strong>. As such, this breaks my code, cause the second imported module isn't available.</p>
  
  <p>My current work around is to include a redundant assignment, but this looks ugly:</p>
  
  <pre><code>import whatever = module("just/referencingthis/forpackaging");
  var a = whatever; // a is never ever used further down this module
  </code></pre>
  
  <p>Does anyone know if it's possible to configure the TypeScript compiler to not optimize modules during compile?</p>