I am getting the following error on typescript file when I try to attach a click event handler as shown below,
Argument of type 'string' is not assignable to parameter of type '{ [key:string]:any;}
I have jQuery 2.1.4 and jquery.TypeScript.DefinitelyTyped 3.0.4 configured in my ASP.NET Web Application.
Edit:
My typescript file is able to pickup the definition file as shown below,
in my JQuery.d.ts,I see the following overloads,
on(events: string, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery;
on(events: string, data : any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery;
on(events: string, selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery;
on(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery;
on(events: { [key: string]: any; }, selector?: string, data?: any): JQuery;
on(events: { [key: string]: any; }, data?: any): JQuery;
What am I missing? Any hint / suggestion will be greatly appreciated.
on
definition in jquery.d.ts. Basically, because the definition includes the[key:string]:any
overload before theevents: string
overload, the TypeScript parser fails to find it. I believe the latest version of the definition file on DefinitelyTyped (3.1.1) has corrected that. – Heretic Monkey