I'm in the process of building a declaration source file for KeyboardJS. The API is referenced from a static object (KeyboardJS) instantiated when the JavaScript file is loaded. A few of the methods of the API are nested under other methods. For example:
KeyboardJS.clear(keyCombo);
and
KeyboardJS.clear.key(key);
Here is my interface definition:
interface KeyboardJSStatic {
enable(): void;
disable(): void;
activeKeys(): string[];
on(keyCombo:string, onDownCallback?: (keyEvent: Event, keysPressed: string[], keyCombo: string) => {}, onUpCallback?: (keyEvent: Event, keysPressed: string[], keyCombo: string) => {}): KeyboardJSBinding;
clear(keyCombo: string): void;
clear.key(keyName: string): void;
locale(localeName: string): KeyboardJSLocale;
locale.register(localeName: string, localeDefinition: KeyboardJSLocale): void;
macro(keyCombo:string , keyNames: string[]): void;
macro.remove(keyCombo: string): void;
key: KeyboardJSKey;
combo: KeyboardJSCombo;
}
The TypeScript plugin for Visual Studio 2012 is generating and error on the clear.key line, recommending a semicolon for where the period is. Has anyone built a definition file with a similar scenario? Thanks!