Does anyone know why the hell i can't use jQuery in my TypeScript code (tho it looks like noone else doesn't have that problem).
I've made a new TypeScript project in VS2012, included the jquery.d.ts, added a script tag pointing to jquery cdn in the main html file, and in the main app.ts file i've added "
/// <reference path="jquery.d.ts" />
at the top of the file and underneath a simple line "$("something").hide();". The intellisense worked fine, tho when I try to compile it I get an error with code 1. I checked it in the command window and it said "The name '$' does not exist in the current scope".
Does anyone know whats going on? Generally I have a very hard time splitting my code to different files, I had to write the whole app in one file. I tried to use modules, import and export but everything ends up in a scope error thrown by the compiler :/
Please save me
EDIT @Sohnee Its a default Typescript project from VS:
Structure:
app.css
app.ts
--app.js
default.htm
jquery.d.ts
Modified files:
1) app.ts:
/// <reference path="jquery.d.ts" />
$("body").hide();
2) default.htm
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>TypeScript HTML App</title>
<link rel="stylesheet" href="app.css" type="text/css" />
<script src="http://code.jquery.com/jquery-1.8.0.js"></script>
<script src="app.js"></script>
</head>
<body>
<h1>TypeScript HTML App</h1>
<div id="content"/>
</body>
</html>