Declaring a JS library for use with TypeScript
You should not need to edit jquery.d.ts
itself; put these definitions in their own file so they can be maintained properly. Something minimal would be like this:
// For methods on e.g. $('a')
interface JQuery {
address(callback?: () => void): JQuery;
}
// For methods on $
interface JQueryStatic {
address: JQueryAddressStatic;
}
interface JQueryAddressStatic {
(): JQuery;
parameter(name: string): string;
parameter(name: string, value: string, append?: boolean): JQuery;
}
The following goes inside jquery.d.ts
:
interface JQueryStatic {
address(options): JQueryAddress;
}
interface JQueryAddress {
parameter(name, value): any;
}
Hope that helps!