Introduction
While working in Typescript Projects I found it tricky to include external JavaScript Frameworks like JQuery.js, Moment.js and so on.
I tried to look on Google to find some help around it but didn’t find any step by step tutorial to get it implemented.
The purpose of this blog post is to help Typescript newbies with projects involving external JavaScript Frameworks.

In order to start with this demo, first, we will create an “HTML Application with Typescript” project using Visual Studio Typescript Template.
Enter “Project Name, Location and Solution Name” as required and click OK.

Once the Project has been created successfully we can add the required typescript code in the “App.ts” file while HTML elements in the “index.html” file.
For the sake of this demo, I have added a simple code that requires JQuery.js.
In the index.html file we can see JQuery code construct as “$(document).ready ()”, which requires “JQuery.js” as a dependency.

In the “App.ts” file I have added “$(#content).append()” which requires JQuery to be included in the typescript.

Now let’s try to run this project by pressing “F5” and see what we get.
And Boom. We get this error since we don’t have JQuery file included in this project as shown in the following screenshots-

We can further see the error message generated by the runtime as below,

In typescript projects that required external JavaScript Frameworks, we need to first install the Type Definition for the respective framework.
For example, in this demo, since we need to include JQuery to the project so what we need to first install Type Definition for JQuery.









Join the conversation! Your thoughts help the community grow.