As I mentioned in a previous blog post, one of the great features of TypeScript is the support for definition files. For most popular JavaScript libraries a definition file exists, but last week I wanted to use a jQuery widget that didn’t had a type definition file(yet).
So I decided to create one myself. The important part is to understand how to link your widget to the existing jQuery type definitions.
If you want to extend the $ sign directly, you have to create an interface JQueryStatic and put your functions in it.
If you want to extend the $(‘’) selector method, you have to create an interface JQuery and put your functions there.