I have many dialogs on my site (login dialog, registration dialog, contact dialog, etc.) that I am trying to simulate using Typescript.
The jquery-ui d.ts file defines the Dialog interface as such:
interface Dialog extends Widget, DialogOptions, DialogEvents{ }
Everything in DialogOptions and DialogEvents is optional, so there is no problem, but the Widget interface defines some call signatures that I don’t understand:
interface Widget { (methodName: string): JQuery; (options: WidgetOptions): JQuery; (options: AccordionOptions): JQuery; (optionLiteral: string, optionName: string): any; (optionLiteral: string, options: WidgetOptions): any; (optionLiteral: string, optionName: string, optionValue: any): JQuery; (name: string, prototype: any): JQuery; (name: string, base: Function, prototype: any): JQuery; }
When I try to implement this interface in a class:
class LoginDialog implements Dialog { }
The compiler complains:
Class 'LoginDialog' declares interface 'Dialog' but does not implement it: Type 'Dialog' requires a call signature, but Type 'LoginDialog' lacks one.
I don’t understand how to implement these “signature signatures” or what they should do, in fact, I don’t even understand what a call signature is.
EDIT:
I found one type of valid use case for signing a call to enter text:
interface ICallback{ (param: string) : void; } function someMethod(callback: ICallback){ callback('a string');
However, the question still persists, since I could not find a precedent for several call signatures and still do not understand how to implement the jquery-ui.d.ts dialog interface