I'm writing a TypeScript definition file for a jQuery library which has the following syntax:
$.library({ /* options object */ }); // Returns an Object
$.library.methodOne(); // Void
$.library.methodTwo(); // Void
So I tried writing the following interface:
interface JQueryStatic {
library: StaticLibraryMethods; // Defines the static methods
library(options:LibraryOptions): Object; // Defines the options overflow
}
interface StaticLibraryMethods {
methodOne(): void;
methodTwo(): void;
}
But I get an error in JQueryStatic:
Duplicate identifier "library"
Is there any way to write a definition for this kind of syntax without modifying library itself?