Skip to content

Commit 8ef39cf

Browse files
committed
Merge pull request DefinitelyTyped#1370 from hesselink/jquery-event-specialization
jQuery: split out Event constructor in separate object.
2 parents 59269a4 + 0f8fda7 commit 8ef39cf

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

jquery/jquery.d.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,18 @@ interface JQueryParam {
337337
(obj: any, traditional: boolean): string;
338338
}
339339

340+
/**
341+
* The interface used to construct jQuery events (with $.Event). It is
342+
* defined separately instead of inline in JQueryStatic to allow
343+
* overriding the construction function with specific strings
344+
* returning specific event objects.
345+
*/
346+
interface JQueryEventConstructor {
347+
(name: string, eventProperties?: any): JQueryEventObject;
348+
new (name: string, eventProperties?: any): JQueryEventObject;
349+
}
350+
351+
340352
/*
341353
Static members of jQuery (those on $ and jQuery themselves)
342354
*/
@@ -529,10 +541,7 @@ interface JQueryStatic {
529541
proxy(fn: (...args: any[]) => any, context: any, ...args: any[]): any;
530542
proxy(context: any, name: string, ...args: any[]): any;
531543

532-
Event: {
533-
(name: string, eventProperties?: any): JQueryEventObject;
534-
new (name: string, eventProperties?: any): JQueryEventObject;
535-
};
544+
Event: JQueryEventConstructor;
536545

537546
// Internals
538547
error(message: any): JQuery;

0 commit comments

Comments
 (0)