Skip to content

Commit 273a567

Browse files
committed
Merge pull request DefinitelyTyped#5878 from MizardX/master
Three small fixes for jQuery and jQuery UI
2 parents b609b5c + c98e750 commit 273a567

File tree

3 files changed

+21
-12
lines changed

3 files changed

+21
-12
lines changed

jquery/jquery-tests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3359,7 +3359,7 @@ function test_promise_then_change_type() {
33593359
var def = $.Deferred<any>();
33603360
var promise = def.promise(null);
33613361

3362-
def.rejectWith(this, new Error());
3362+
def.rejectWith(this, [new Error()]);
33633363

33643364
return promise;
33653365
}

jquery/jquery.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ interface JQueryCallback {
241241
* @param context A reference to the context in which the callbacks in the list should be fired.
242242
* @param arguments An argument, or array of arguments, to pass to the callbacks in the list.
243243
*/
244-
fireWith(context?: any, ...args: any[]): JQueryCallback;
244+
fireWith(context?: any, args?: any[]): JQueryCallback;
245245

246246
/**
247247
* Determine whether a supplied callback is in a list
@@ -395,7 +395,7 @@ interface JQueryDeferred<T> extends JQueryGenericPromise<T> {
395395
* @param context Context passed to the progressCallbacks as the this object.
396396
* @param args Optional arguments that are passed to the progressCallbacks.
397397
*/
398-
notifyWith(context: any, value?: any, ...args: any[]): JQueryDeferred<T>;
398+
notifyWith(context: any, value?: any[]): JQueryDeferred<T>;
399399

400400
/**
401401
* Reject a Deferred object and call any failCallbacks with the given args.
@@ -409,7 +409,7 @@ interface JQueryDeferred<T> extends JQueryGenericPromise<T> {
409409
* @param context Context passed to the failCallbacks as the this object.
410410
* @param args An optional array of arguments that are passed to the failCallbacks.
411411
*/
412-
rejectWith(context: any, value?: any, ...args: any[]): JQueryDeferred<T>;
412+
rejectWith(context: any, value?: any[]): JQueryDeferred<T>;
413413

414414
/**
415415
* Resolve a Deferred object and call any doneCallbacks with the given args.
@@ -425,7 +425,7 @@ interface JQueryDeferred<T> extends JQueryGenericPromise<T> {
425425
* @param context Context passed to the doneCallbacks as the this object.
426426
* @param args An optional array of arguments that are passed to the doneCallbacks.
427427
*/
428-
resolveWith(context: any, value?: T, ...args: any[]): JQueryDeferred<T>;
428+
resolveWith(context: any, value?: T[]): JQueryDeferred<T>;
429429

430430
/**
431431
* Return a Deferred's Promise object.

jqueryui/jqueryui.d.ts

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
declare module JQueryUI {
1010
// Accordion //////////////////////////////////////////////////
1111

12-
interface AccordionOptions {
12+
interface AccordionOptions extends AccordionEvents {
1313
active?: any; // boolean or number
1414
animate?: any; // boolean, number, string or object
1515
collapsible?: boolean;
@@ -37,7 +37,7 @@ declare module JQueryUI {
3737
create?: AccordionEvent;
3838
}
3939

40-
interface Accordion extends Widget, AccordionOptions, AccordionEvents {
40+
interface Accordion extends Widget, AccordionOptions {
4141
}
4242

4343

@@ -342,7 +342,7 @@ declare module JQueryUI {
342342

343343
interface DialogOptions extends DialogEvents {
344344
autoOpen?: boolean;
345-
buttons?: { [buttonText: string]: (event?: Event) => void } | ButtonOptions[];
345+
buttons?: { [buttonText: string]: (event?: Event) => void } | DialogButtonOptions[];
346346
closeOnEscape?: boolean;
347347
closeText?: string;
348348
dialogClass?: string;
@@ -366,6 +366,14 @@ declare module JQueryUI {
366366
close?: DialogEvent;
367367
}
368368

369+
interface DialogButtonOptions {
370+
icons?: any;
371+
showText?: string | boolean;
372+
text?: string;
373+
click?: (eventObject: JQueryEventObject) => any;
374+
[attr: string]: any; // attributes for the <button> element
375+
}
376+
369377
interface DialogShowHideOptions {
370378
effect: string;
371379
delay?: number;
@@ -517,9 +525,10 @@ declare module JQueryUI {
517525

518526
// Progressbar //////////////////////////////////////////////////
519527

520-
interface ProgressbarOptions {
528+
interface ProgressbarOptions extends ProgressbarEvents {
521529
disabled?: boolean;
522530
value?: number | boolean;
531+
max?: number;
523532
}
524533

525534
interface ProgressbarUIParams {
@@ -535,7 +544,7 @@ declare module JQueryUI {
535544
create?: ProgressbarEvent;
536545
}
537546

538-
interface Progressbar extends Widget, ProgressbarOptions, ProgressbarEvents {
547+
interface Progressbar extends Widget, ProgressbarOptions {
539548
}
540549

541550

@@ -793,7 +802,7 @@ declare module JQueryUI {
793802

794803
// Tooltip //////////////////////////////////////////////////
795804

796-
interface TooltipOptions {
805+
interface TooltipOptions extends TooltipEvents {
797806
content?: any; // () or string
798807
disabled?: boolean;
799808
hide?: any; // boolean, number, string or object
@@ -816,7 +825,7 @@ declare module JQueryUI {
816825
open?: TooltipEvent;
817826
}
818827

819-
interface Tooltip extends Widget, TooltipOptions, TooltipEvents {
828+
interface Tooltip extends Widget, TooltipOptions {
820829
}
821830

822831

0 commit comments

Comments
 (0)