Typescript and JQuery compile error: Cannot find name '$'
<p>I'm testing typescript with jquery, but when I compile the test.ts file, it always gives me an error indicating: Cannot find name '$'.</p>

<p>I've already imported jquery &amp; added its definition reference.
If I use <code>import $ = require("jquery")</code> in my <code>test.ts</code> file, another error "<code>Cannot find module jquery</code>" will occur when doing the <code>tsc</code> compiling.  However, the JQuery folder already exists within the node_modules folder.</p>

<p>Does anyone know what is the correct way to use jquery in typescript?</p>

<p>Below is my steps:</p>

<ol>
<li>Install jquery using <code>npm install jquery --save</code></li>
<li>Install typings &amp; jquery definition using <code>typings install --global --save dt~jquery</code></li>
<li>Add jquery reference at top of test.ts <code>/// &lt;reference path="../../../typings/globals/jquery/index.d.ts" /&gt;</code></li>
</ol>

<p><strong>tsconfig.json</strong></p>

<pre><code>{
    "compilerOptions": {
        "jsx": "react",
        "outDir": "./dist",
        "sourceMap": true,
        "noImplicitAny": true,
        "module": "commonjs",
        "target": "es5",
        "experimentalDecorators": true
    },
    "exclude": [
        "node_modules"
    ],
    "files": [
        "./typings/index.d.ts",
        "./src/wo/tests/test.ts",
    ]
}
</code></pre>

<p><strong>test.ts</strong></p>

<pre><code>/// &lt;reference path="../../../typings/globals/jquery/index.d.ts" /&gt;

let test:any=$("div");
</code></pre>