title: Typescript AMD implementation bad with Javascript / RequireJS
body: <p>If I have this ts module: </p>
  
  <pre><code>export function say(){
      console.log("said");
  }
  </code></pre>
  
  <p>and I compile it with the amd option I can use it quite easily from a ts client : </p>
  
  <pre><code>import foo = module("tsmodule")
  foo.say();
  
  export var x = 123;
  </code></pre>
  
  <p>However if I have javascript equivalent to the ts module: </p>
  
  <pre><code>define(["require", "exports"], function(require, exports) {
      function say() {
          console.log("said");
      }
      exports.say = say;
  })
  </code></pre>
  
  <p>There is no way to use it easily. The simplest possible solution: </p>
  
  <pre><code>// of course you can use .d.ts for requirejs but that is beside the point
  declare var require:any;
  
  // will fail with error module has not been loaded yet for context
  // http://requirejs.org/docs/errors.html#notloaded
  var useme = require("jsmodule")
  useme.say();
  
  export var x = 123;
  import foo = module("tsmodule")
  foo.say();
  </code></pre>
  
  <p>fails because of error <a href="http://requirejs.org/docs/errors.html#notloaded" rel="noreferrer">http://requirejs.org/docs/errors.html#notloaded</a> . Since "jsmodule" was not passed to the define call in the generated typescript. </p>
  
  <p>The two workarounds I have </p>
  
  <ul>
  <li>don't use import / export (language features lost) </li>
  <li>use require([]) (still can't export something that depends on the require([]) call) </li>
  </ul>
  
  <p>have limitations : <a href="https://github.com/basarat/typescript-requirejs" rel="noreferrer">https://github.com/basarat/typescript-requirejs</a> . Is there another way? If not can you vote here : <a href="https://typescript.codeplex.com/workitem/948" rel="noreferrer">https://typescript.codeplex.com/workitem/948</a> :) </p>