Introduction
JQuery is one of the most popular JavaScript libraries which exposes a lot of usable APIs for JavaScript developers. It’s an integration with Typescript that may do wonders for you.
I am taking my previous code sample for the demonstration.
In my previous sample, I displayed a message in the alert box, but in this sample, I will display a message in the UI with the help of JQuery functions.
How to integrate with Typescript
- Open project in Visual Studio.
- Right click “TypescriptDemo” project and go to Nuget package manager.
- Type “definitely” in a search box.

You will see the list of libraries; which have an extension as “*.d.ts” and is called ‘DefinitelyTyped”, which are specific to Typescript projects.
For our sample, we will select “jquery.TypeScript.DefinitelyTyped” and install.
This will add a jQuery version of Typescript with an extension same as of Typescript files.
Drag and drop this “jquery.d.ts” file on the “demo.ts” file. This will add a reference to the JQuery library. Now, you are ready to use all the API’s of jQuery in your Typescript files.
Open “demo.ts” and make changes in “Play” function, as shown below:








shital patelPosted Apr 25, 2018, 4:15 AM
Thanks for give solution.Its working
Michael PalmerPosted Jan 26, 2018, 12:24 PM
Thanks for sharing. I really wish C# Corner would switch from putting screenshots of code to putting actual code that can be copied.
devendra soniPosted Jun 10, 2016, 1:24 AM
Awesome
farooq smdPosted Jun 9, 2016, 11:47 AM
nice one
Vignesh ManiPosted Jun 9, 2016, 4:56 AM
Nice one
Ashish BajpaiPosted Jun 9, 2016, 1:03 AM
Thank you, Friends..
Santhakumar MunuswamyPosted Jun 8, 2016, 11:53 PM
Thank you for nice share
Sonu ChaudharyPosted Jun 8, 2016, 2:48 PM
good one ..
Kuppurasu NagarajPosted Jun 8, 2016, 12:20 PM
Nice Sharing..