From 164fe71822bb2f6528fa8effc05812700493d320 Mon Sep 17 00:00:00 2001 From: MizardX Date: Thu, 17 Sep 2015 20:44:23 +0200 Subject: [PATCH 1/5] Fix jQuery Deferred and Callback *With-method signatures. The Callback.fireWith, Deferred.notifyWith, Deferred.rejectWith, and Deferred.resolveWith methods require you to pass the arguments as an array. --- jquery/jquery.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index ad9e93455..b67605685 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -241,7 +241,7 @@ interface JQueryCallback { * @param context A reference to the context in which the callbacks in the list should be fired. * @param arguments An argument, or array of arguments, to pass to the callbacks in the list. */ - fireWith(context?: any, ...args: any[]): JQueryCallback; + fireWith(context?: any, args: any[]): JQueryCallback; /** * Determine whether a supplied callback is in a list @@ -395,7 +395,7 @@ interface JQueryDeferred extends JQueryGenericPromise { * @param context Context passed to the progressCallbacks as the this object. * @param args Optional arguments that are passed to the progressCallbacks. */ - notifyWith(context: any, value?: any, ...args: any[]): JQueryDeferred; + notifyWith(context: any, value?: any[]): JQueryDeferred; /** * Reject a Deferred object and call any failCallbacks with the given args. @@ -409,7 +409,7 @@ interface JQueryDeferred extends JQueryGenericPromise { * @param context Context passed to the failCallbacks as the this object. * @param args An optional array of arguments that are passed to the failCallbacks. */ - rejectWith(context: any, value?: any, ...args: any[]): JQueryDeferred; + rejectWith(context: any, value?: any[]): JQueryDeferred; /** * Resolve a Deferred object and call any doneCallbacks with the given args. @@ -425,7 +425,7 @@ interface JQueryDeferred extends JQueryGenericPromise { * @param context Context passed to the doneCallbacks as the this object. * @param args An optional array of arguments that are passed to the doneCallbacks. */ - resolveWith(context: any, value?: T, ...args: any[]): JQueryDeferred; + resolveWith(context: any, value?: T[]): JQueryDeferred; /** * Return a Deferred's Promise object. From 6999e694e7879621dbef0719d975f01a41b95986 Mon Sep 17 00:00:00 2001 From: MizardX Date: Thu, 17 Sep 2015 20:44:54 +0200 Subject: [PATCH 2/5] Include events in Accordion, Progressbar and Tooltip options. Except for Accordion, Progressbar and Tooltip, all other widgets in this file follow this pattern. --- jqueryui/jqueryui.d.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/jqueryui/jqueryui.d.ts b/jqueryui/jqueryui.d.ts index a5f77eade..ac8264067 100644 --- a/jqueryui/jqueryui.d.ts +++ b/jqueryui/jqueryui.d.ts @@ -9,7 +9,7 @@ declare module JQueryUI { // Accordion ////////////////////////////////////////////////// - interface AccordionOptions { + interface AccordionOptions extends AccordionEvents { active?: any; // boolean or number animate?: any; // boolean, number, string or object collapsible?: boolean; @@ -37,7 +37,7 @@ declare module JQueryUI { create?: AccordionEvent; } - interface Accordion extends Widget, AccordionOptions, AccordionEvents { + interface Accordion extends Widget, AccordionOptions { } @@ -517,9 +517,10 @@ declare module JQueryUI { // Progressbar ////////////////////////////////////////////////// - interface ProgressbarOptions { + interface ProgressbarOptions extends ProgressbarEvents { disabled?: boolean; value?: number | boolean; + max?: number; } interface ProgressbarUIParams { @@ -535,7 +536,7 @@ declare module JQueryUI { create?: ProgressbarEvent; } - interface Progressbar extends Widget, ProgressbarOptions, ProgressbarEvents { + interface Progressbar extends Widget, ProgressbarOptions { } @@ -793,7 +794,7 @@ declare module JQueryUI { // Tooltip ////////////////////////////////////////////////// - interface TooltipOptions { + interface TooltipOptions extends TooltipEvents { content?: any; // () or string disabled?: boolean; hide?: any; // boolean, number, string or object @@ -816,7 +817,7 @@ declare module JQueryUI { open?: TooltipEvent; } - interface Tooltip extends Widget, TooltipOptions, TooltipEvents { + interface Tooltip extends Widget, TooltipOptions { } From a5fabe45ece37ea906252e1b7ab75444cfea8c73 Mon Sep 17 00:00:00 2001 From: MizardX Date: Thu, 17 Sep 2015 20:45:51 +0200 Subject: [PATCH 3/5] Correct the interface for the Dialog buttons. Only the "icons" and "showText" (as "text") options are forwarded to .button(), the rest are passed as a parameter to the element constructor: http://api.jquery.com/jQuery/#jQuery-html-attributes --- jqueryui/jqueryui.d.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/jqueryui/jqueryui.d.ts b/jqueryui/jqueryui.d.ts index ac8264067..a49a779e2 100644 --- a/jqueryui/jqueryui.d.ts +++ b/jqueryui/jqueryui.d.ts @@ -342,7 +342,7 @@ declare module JQueryUI { interface DialogOptions extends DialogEvents { autoOpen?: boolean; - buttons?: { [buttonText: string]: (event?: Event) => void } | ButtonOptions[]; + buttons?: { [buttonText: string]: (event?: Event) => void } | DialogButtonOptions[]; closeOnEscape?: boolean; closeText?: string; dialogClass?: string; @@ -366,6 +366,14 @@ declare module JQueryUI { close?: DialogEvent; } + interface DialogButtonOptions { + icons?: any; + showText?: string | boolean; + text?: string; + click?: (eventObject: JQueryEventObject) => any; + [attr: string]: any; // attributes for the