{"id":478,"date":"2013-06-14T20:23:03","date_gmt":"2013-06-14T20:23:03","guid":{"rendered":"http:\/\/putridparrot.com\/blog\/?p=478"},"modified":"2013-06-14T20:26:11","modified_gmt":"2013-06-14T20:26:11","slug":"using-jquery-in-typescript","status":"publish","type":"post","link":"https:\/\/putridparrot.com\/blog\/using-jquery-in-typescript\/","title":{"rendered":"Using jQuery in TypeScript"},"content":{"rendered":"<p>As somebody who mainly develops in C# I do miss strong typing when using JavaScript. So I&#8217;ve started to use TypeScript which solves this. But let&#8217;s face it, this would be of little use without jQuery (and other frameworks). So here&#8217;s the steps to get jQuery running with TypeScript.<\/p>\n<ol>\n<li>If you have already installed TypeScript, grab the latest VS2012 integration from <a href=\"http:\/\/www.typescriptlang.org\/\">http:\/\/www.typescriptlang.org\/<\/a><\/li>\n<li>Next up, create a new project, navigate to Other Languages | TypeScript and create a new TypeScript project<\/li>\n<li>From the References section in the solution explorer, right mouse click and select Manage NuGet Packages and search for jquery.TypeScript.DefinitelyType and install &#8211; this will install a .ts file which includes the jQuery TypeScript definition to allows us to work with code completion<\/li>\n<li>Now either from NuGet, install jQuery or download from <a href=\"http:\/\/jquery.com\/\">http:\/\/jquery.com\/<\/a><\/li>\n<li>To reference the jQuery TypeScript file put <em>\/\/\/ <\/em> at the top of the app.ts file, this will allow VS2012 to reference the types in the .ts file<\/li>\n<li>You&#8217;ll need to add a <em><script type=\"text\/javascript\" src=\"jquery-1.10.1.js\"><\/script><\/em> script to the default.htm file<\/li>\n<\/ol>\n<p>Now we&#8217;ve got jQuery up and running in TypeScript.<\/p>\n<p>Note: One problem I found on one of my machines was the code complete didn&#8217;t work for TypeScript, reading up on this on it appeared (as suggested in one of the posts) that MySQL Connector Net 6.6.5 was causing the problem. Open <em>Control Panel | Programs | Programs and Features<\/em>, location My SQL Connector 6.6.5 if its installed. Right mouse click on it and select <em>Change<\/em> and remove the Visual Studio Integration.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As somebody who mainly develops in C# I do miss strong typing when using JavaScript. So I&#8217;ve started to use TypeScript which solves this. But let&#8217;s face it, this would be of little use without jQuery (and other frameworks). So here&#8217;s the steps to get jQuery running with TypeScript. If you have already installed TypeScript, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[46],"tags":[],"class_list":["post-478","post","type-post","status-publish","format-standard","hentry","category-typescript"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/478","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/comments?post=478"}],"version-history":[{"count":9,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/478\/revisions"}],"predecessor-version":[{"id":489,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/478\/revisions\/489"}],"wp:attachment":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/media?parent=478"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/categories?post=478"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/tags?post=478"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}