title: Cannot reference object using TypeScript and Require.JS
body: <p>I have a TypeScript project. Basically I have a file called <code>myId.ts</code>:</p>
  
  <pre><code>export module MyModule {
      export class MyId {
          constructor() { ... }
          public compareTo(other: MyId): number { ... }
          public toString(): string { ... }
      }
  }
  </code></pre>
  
  <p>I have a <code>tsconfig.json</code>:</p>
  
  <pre><code>{
      "compilerOptions": {
          "target": "es5",
          "noImplicitAny": true,
          "removeComments": false,
          "preserveConstEnums": true,
          "sourceMap": false,
          "module": "amd",
          "outDir": "./out"
      },
      "files": [
          "myId.ts"
      ]
  }
  </code></pre>
  
  <p>I compile this thing using this command:</p>
  
  <pre><code>tsc --project .
  </code></pre>
  
  <p>Where the current directory contains the configuration file ad also the source file.</p>
  
  <p>Well, when compiling everything is fine, I get <code>out/myId.js</code>:</p>
  
  <pre><code>define(["require", "exports"], function (require, exports) {
      var MyModule;
      (function (MyModule) {
          var MyId = (function () {
              function MyId() { ... }
              MyId.prototype.compareTo = function (other) { ... };
              MyId.prototype.toString = function () { ... };
          })();
          MyModule.MyId = MyId;
      })(MyModule = exports.MyModule || (exports.MyModule = {}));
  });
  </code></pre>
  
  <h2>Problems referencing <code>MyId</code></h2>
  
  <p>Well, I want to use this in a web page and call it from using JavaScript, so by following <a href="http://requirejs.org/docs/start.html" rel="nofollow">Require.JS guidelines</a>, I create my web page:</p>
  
  <pre><code>&lt;html&gt;
    &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;title&gt;EVT Example - Minimal&lt;/title&gt;
      &lt;script src="./require.js" type="text/javascript" data-main="./myId"&gt;&lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;&lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>However, when I open the inspector (F12 tools) and try referencing <code>MyModule.MyId</code>, nothing can be found! How can I reference my type?</p>
  
  <h3>Everything loaded fine</h3>
  
  <p>The inspector told me that <code>myId.js</code> has been successfully loaded actually. So it is not a problem concerning the fact that Require.JS did not load the script.</p>
  
  <p>What to do?</p>