I have developed some custom jQuery
extensions in JavaScript. They are accessed as follows:
var myNumber = $.myStaticFunction(myString);
var myObject = $('selector').myElementFunction(myString);
In order to use these functions in the TypeScript section, I can modify the index.d.ts file of jQuery:
interface JQuery<TElement extends Node = HTMLElement> extends Iterable<TElement> {
...
myElementFunction: (sr:string) => {foo:number, bar:string};
...
interface JQueryStatic<TElement extends Node = HTMLElement> {
...
myStaticFunction: (sr:string) => number;
...
I realize that directly modifying the index.d.ts may not be the best approach. Perhaps I should create a separate myextension.d.ts file instead. How should I write the definition file for jQuery extensions?