title: typescript compiler flags requirejs shim definitions as errors. How to fix it?
body: <p>I am trying to work exclusively in typescript for the front end of an ASP.Net MVC application. This is working right now without modules and the dependency tracking is getting onerous. So it is time to bring in RequireJS and use Typescript's support of AMD. </p>
  
  <p>I have read a lot about this and I think I am very close. However, I am running into a problem with the import statement of typescript saying that it can't find the shim modules that are defined in the requireJS configuration. So if typescript would just pass the name of the module through to the require function in the JS code, everything would work great. But it doesn't, it just throws an error. So the question is how am I supposed to write the import statement for these JS shims? </p>
  
  <p>Here is an example:
  app.ts</p>
  
  <pre><code>import g = require("Api/greeter");
  import $ = require("jquery");
  import respond = require("respond");
  
  var greeter = new g.Greeter("#content");
  greeter.start();
  </code></pre>
  
  <p>Lets assume this is the main TS for a page and greeter is the view model for that page. But I know that I need jquery and bootstrap on the page. I have this setup for my requireJS config:</p>
  
  <p>/// </p>
  
  <pre><code>requirejs.config({
      baseUrl: 'Scripts',
      paths: {
          "jquery": "libs/jquery-3.1.1",
          "bootstrap": "libs/bootstrap.min",
          "respond" : "libs/respond"
      },
      shim: {
          "bootstrap": { deps: ["jquery"] },
          "respond": { deps: ["bootstrap"] }
      }
  });
  
  require(['App/app']);
  </code></pre>
  
  <p>Notice I have respond requiring bootstrap and bootstrap requiring jQuery. So having app.ts require respond should (and does) pull in respond, bootstrap and jQuery. </p>
  
  <p>I know I have a redundant require("jQuery") in app.ts. That is for illustrative purposes only. Ie, that line works fine - TS recognizes jQuery as a valid module name and puts it into the resulting compiled JS file. But TS doesn't recognize "respond" as a module name and I get a compile error:</p>
  
  <pre><code>Cannot find module 'respond'.
  </code></pre>
  
  <p>I have my files arranged like this:</p>
  
  <pre><code>Scripts
  -&gt;Api
      --&gt; Greeter.ts
  -&gt; App
      --&gt; App.ts
  -&gt; libs
      --&gt; jQuery-3.1.1.js
      --&gt; bootstrap.js
      --&gt; respond.js
  </code></pre>
  
  <p>I thought I was doing well when jQuery worked but how do I get respond or any other pure JS library I have to pull in to work? From what I can tell in the TS docs, the argument to require() is supposed to be a valid path to a JS file because that's how the compiler is going to get the type information. But if that is the case, why does jQuery work the way I have it defined? It is no different than respond.js.</p>
  
  <p>Thanks
  Greg</p>