using jQuery in TypeScript with Visual Studio Code
If you are building a TypeScript project in Visual Studio Code you will get intellisense and that is cool. But if you want to add jQuery into your ts file the intellisense shows you errors. So how to use it?
All you need to do are some simple steps.
That's it. Your done.
All you need to do are some simple steps.
- Create the folders structur typings/jquery in your project folder.
- Get the latest jQuery type definition (a kind of parsed version) from GitHub. Click Raw and save the file as jquery.d.ts into the typings/jquery folder.
- Add a reference in your ts file using the following line:
1 | /// <reference path="typings/jquery/jquery.d.ts" />
|
That's it. Your done.
Comments
Post a Comment