mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
[jquery] when() does not emit progress notifications.
This commit is contained in:
58
types/jquery/index.d.ts
vendored
58
types/jquery/index.d.ts
vendored
@@ -3273,9 +3273,11 @@ interface JQueryStatic<TElement extends Node = HTMLElement> {
|
||||
when<TR1, TJ1 = any, TN1 = any,
|
||||
UR1 = any, UJ1 = any, UN1 = any,
|
||||
VR1 = any, VJ1 = any, VN1 = any>
|
||||
(deferredT: TR1 | JQuery.Thenable<TR1> | JQuery.Promise<TR1, TJ1, TN1>,
|
||||
deferredU: UR1 | JQuery.Thenable<UR1> | JQuery.Promise<UR1, UJ1, UN1>,
|
||||
deferredV: VR1 | JQuery.Thenable<VR1> | JQuery.Promise<VR1, VJ1, VN1>): JQuery.Promise3<TR1, TJ1, TN1, UR1, UJ1, UN1, VR1, VJ1, VN1>;
|
||||
(deferredT: JQuery.Promise<TR1, TJ1, TN1> | JQuery.Thenable<TR1> | TR1,
|
||||
deferredU: JQuery.Promise<UR1, UJ1, UN1> | JQuery.Thenable<UR1> | UR1,
|
||||
deferredV: JQuery.Promise<VR1, VJ1, VN1> | JQuery.Thenable<VR1> | VR1): JQuery.Promise3<TR1, TJ1, never,
|
||||
UR1, UJ1, never,
|
||||
VR1, VJ1, never>;
|
||||
/**
|
||||
* Provides a way to execute callback functions based on zero or more Thenable objects, usually
|
||||
* Deferred objects that represent asynchronous events.
|
||||
@@ -3292,14 +3294,14 @@ interface JQueryStatic<TElement extends Node = HTMLElement> {
|
||||
VR1 = never, VJ1 = never, VN1 = never,
|
||||
VR2 = never, VJ2 = never, VN2 = never,
|
||||
VR3 = never, VJ3 = never, VN3 = never>
|
||||
(deferredT: JQuery.Promise2<TR1, TJ1, TN1, TR2, TJ2, TN2> |
|
||||
JQuery.Promise3<TR1, TJ1, TN1, TR2, TJ2, TN2, TR3, TJ3, TN3>,
|
||||
deferredU: JQuery.Promise2<UR1, UJ1, UN1, UR2, UJ2, UN2> |
|
||||
JQuery.Promise3<UR1, UJ1, UN1, UR2, UJ2, UN2, UR3, UJ3, UN3>,
|
||||
deferredV: JQuery.Promise2<VR1, VJ1, VN1, VR2, VJ2, VN2> |
|
||||
JQuery.Promise3<VR1, VJ1, VN1, VR2, VJ2, VN2, VR3, VJ3, VN3>): JQuery.Promise3<[TR1, TR2, TR3], [TJ1, TJ2, TJ3], [TN1, TN2, TN3],
|
||||
[UR1, UR2, UR3], [UJ1, UJ2, UJ3], [UN1, UN2, UN3],
|
||||
[VR1, VR2, VR3], [VJ1, VJ2, VJ3], [VN1, VN2, VN3]>;
|
||||
(deferredT: JQuery.Promise3<TR1, TJ1, TN1, TR2, TJ2, TN2, TR3, TJ3, TN3> |
|
||||
JQuery.Promise2<TR1, TJ1, TN1, TR2, TJ2, TN2>,
|
||||
deferredU: JQuery.Promise3<UR1, UJ1, UN1, UR2, UJ2, UN2, UR3, UJ3, UN3> |
|
||||
JQuery.Promise2<UR1, UJ1, UN1, UR2, UJ2, UN2>,
|
||||
deferredV: JQuery.Promise3<VR1, VJ1, VN1, VR2, VJ2, VN2, VR3, VJ3, VN3> |
|
||||
JQuery.Promise2<VR1, VJ1, VN1, VR2, VJ2, VN2>): JQuery.Promise3<[TR1, TR2, TR3], [TJ1, TJ2, TJ3], never,
|
||||
[UR1, UR2, UR3], [UJ1, UJ2, UJ3], never,
|
||||
[VR1, VR2, VR3], [VJ1, VJ2, VJ3], never>;
|
||||
/**
|
||||
* Provides a way to execute callback functions based on zero or more Thenable objects, usually
|
||||
* Deferred objects that represent asynchronous events.
|
||||
@@ -3309,8 +3311,9 @@ interface JQueryStatic<TElement extends Node = HTMLElement> {
|
||||
*/
|
||||
when<TR1, TJ1 = any, TN1 = any,
|
||||
UR1 = any, UJ1 = any, UN1 = any>
|
||||
(deferredT: TR1 | JQuery.Thenable<TR1> | JQuery.Promise<TR1, TJ1, TN1>,
|
||||
deferredU: UR1 | JQuery.Thenable<UR1> | JQuery.Promise<UR1, UJ1, UN1>): JQuery.Promise2<TR1, TJ1, TN1, UR1, UJ1, UN1>;
|
||||
(deferredT: JQuery.Promise<TR1, TJ1, TN1> | JQuery.Thenable<TR1> | TR1,
|
||||
deferredU: JQuery.Promise<UR1, UJ1, UN1> | JQuery.Thenable<UR1> | UR1): JQuery.Promise2<TR1, TJ1, never,
|
||||
UR1, UJ1, never>;
|
||||
/**
|
||||
* Provides a way to execute callback functions based on zero or more Thenable objects, usually
|
||||
* Deferred objects that represent asynchronous events.
|
||||
@@ -3324,11 +3327,11 @@ interface JQueryStatic<TElement extends Node = HTMLElement> {
|
||||
UR1 = never, UJ1 = never, UN1 = never,
|
||||
UR2 = never, UJ2 = never, UN2 = never,
|
||||
UR3 = never, UJ3 = never, UN3 = never>
|
||||
(deferredT: JQuery.Promise2<TR1, TJ1, TN1, TR2, TJ2, TN2> |
|
||||
JQuery.Promise3<TR1, TJ1, TN1, TR2, TJ2, TN2, TR3, TJ3, TN3>,
|
||||
deferredU: JQuery.Promise2<UR1, UJ1, UN1, UR2, UJ2, UN2> |
|
||||
JQuery.Promise3<UR1, UJ1, UN1, UR2, UJ2, UN2, UR3, UJ3, UN3>): JQuery.Promise2<[TR1, TR2, TR3], [TJ1, TJ2, TJ3], [TN1, TN2, TN3],
|
||||
[UR1, UR2, UR3], [UJ1, UJ2, UJ3], [UN1, UN2, UN3]>;
|
||||
(deferredT: JQuery.Promise3<TR1, TJ1, TN1, TR2, TJ2, TN2, TR3, TJ3, TN3> |
|
||||
JQuery.Promise2<TR1, TJ1, TN1, TR2, TJ2, TN2>,
|
||||
deferredU: JQuery.Promise3<UR1, UJ1, UN1, UR2, UJ2, UN2, UR3, UJ3, UN3> |
|
||||
JQuery.Promise2<UR1, UJ1, UN1, UR2, UJ2, UN2>): JQuery.Promise2<[TR1, TR2, TR3], [TJ1, TJ2, TJ3], never,
|
||||
[UR1, UR2, UR3], [UJ1, UJ2, UJ3], never>;
|
||||
/**
|
||||
* Provides a way to execute callback functions based on zero or more Thenable objects, usually
|
||||
* Deferred objects that represent asynchronous events.
|
||||
@@ -3336,7 +3339,7 @@ interface JQueryStatic<TElement extends Node = HTMLElement> {
|
||||
* @see {@link https://api.jquery.com/jQuery.when/}
|
||||
* @since 1.5
|
||||
*/
|
||||
when<TR1, TJ1 = any, TN1 = any>(deferred: TR1 | JQuery.Thenable<TR1> | JQuery.Promise<TR1, TJ1, TN1>): JQuery.Promise<TR1, TJ1, TN1>;
|
||||
when<TR1, TJ1 = any, TN1 = any>(deferred: JQuery.Promise<TR1, TJ1, TN1> | JQuery.Thenable<TR1> | TR1): JQuery.Promise<TR1, TJ1, never>;
|
||||
/**
|
||||
* Provides a way to execute callback functions based on zero or more Thenable objects, usually
|
||||
* Deferred objects that represent asynchronous events.
|
||||
@@ -3346,18 +3349,9 @@ interface JQueryStatic<TElement extends Node = HTMLElement> {
|
||||
*/
|
||||
when<TR1, TJ1, TN1,
|
||||
TR2, TJ2, TN2,
|
||||
TR3, TJ3, TN3>
|
||||
(deferredT: JQuery.Promise3<TR1, TJ1, TN1, TR2, TJ2, TN2, TR3, TJ3, TN3>): JQuery.Promise3<TR1, TJ1, TN1, TR2, TJ2, TN2, TR3, TJ3, TN3>;
|
||||
/**
|
||||
* Provides a way to execute callback functions based on zero or more Thenable objects, usually
|
||||
* Deferred objects that represent asynchronous events.
|
||||
*
|
||||
* @see {@link https://api.jquery.com/jQuery.when/}
|
||||
* @since 1.5
|
||||
*/
|
||||
when<TR1, TJ1, TN1,
|
||||
TR2, TJ2, TN2>
|
||||
(deferredT: JQuery.Promise2<TR1, TJ1, TN1, TR2, TJ2, TN2>): JQuery.Promise2<TR1, TJ1, TN1, TR2, TJ2, TN2>;
|
||||
TR3 = never, TJ3 = never, TN3 = never>
|
||||
(deferredT: JQuery.Promise3<TR1, TJ1, TN1, TR2, TJ2, TN2, TR3, TJ3, TN3> |
|
||||
JQuery.Promise2<TR1, TJ1, TN1, TR2, TJ2, TN2>): JQuery.Promise3<TR1, TJ1, never, TR2, TJ2, never, TR3, TJ3, never>;
|
||||
/**
|
||||
* Provides a way to execute callback functions based on zero or more Thenable objects, usually
|
||||
* Deferred objects that represent asynchronous events.
|
||||
@@ -3366,7 +3360,7 @@ interface JQueryStatic<TElement extends Node = HTMLElement> {
|
||||
* @see {@link https://api.jquery.com/jQuery.when/}
|
||||
* @since 1.5
|
||||
*/
|
||||
when<TR1 = never, TJ1 = never, TN1 = never>(...deferreds: Array<TR1 | JQuery.Thenable<TR1>>): JQuery.Promise<TR1, TJ1, TN1>;
|
||||
when<TR1 = never, TJ1 = never, TN1 = never>(...deferreds: Array<TR1 | JQuery.Thenable<TR1>>): JQuery.Promise<TR1, TJ1, never>;
|
||||
}
|
||||
|
||||
declare namespace JQuery {
|
||||
|
||||
@@ -4449,27 +4449,51 @@ function JQueryStatic() {
|
||||
const w = $.when(t, u, v);
|
||||
|
||||
w.then((a, b, c) => {
|
||||
// $ExpectType [string, SuccessTextStatus, jqXHR<string>]
|
||||
a;
|
||||
// $ExpectType [number, SuccessTextStatus, jqXHR<number>]
|
||||
b;
|
||||
// $ExpectType [boolean, SuccessTextStatus, jqXHR<boolean>]
|
||||
c;
|
||||
// $ExpectType string
|
||||
a[0];
|
||||
// $ExpectType SuccessTextStatus
|
||||
a[1];
|
||||
// $ExpectType jqXHR<string>
|
||||
a[2];
|
||||
// $ExpectType number
|
||||
b[0];
|
||||
// $ExpectType SuccessTextStatus
|
||||
b[1];
|
||||
// $ExpectType jqXHR<number>
|
||||
b[2];
|
||||
// $ExpectType boolean
|
||||
c[0];
|
||||
// $ExpectType SuccessTextStatus
|
||||
c[1];
|
||||
// $ExpectType jqXHR<boolean>
|
||||
c[2];
|
||||
});
|
||||
w.catch((a, b, c) => {
|
||||
// $ExpectType [jqXHR<string>, ErrorTextStatus, string]
|
||||
a;
|
||||
// $ExpectType [jqXHR<number>, ErrorTextStatus, string]
|
||||
b;
|
||||
// $ExpectType [jqXHR<boolean>, ErrorTextStatus, string]
|
||||
c;
|
||||
// $ExpectType jqXHR<string>
|
||||
a[0];
|
||||
// $ExpectType ErrorTextStatus
|
||||
a[1];
|
||||
// $ExpectType string
|
||||
a[2];
|
||||
// $ExpectType jqXHR<number>
|
||||
b[0];
|
||||
// $ExpectType ErrorTextStatus
|
||||
b[1];
|
||||
// $ExpectType string
|
||||
b[2];
|
||||
// $ExpectType jqXHR<boolean>
|
||||
c[0];
|
||||
// $ExpectType ErrorTextStatus
|
||||
c[1];
|
||||
// $ExpectType string
|
||||
c[2];
|
||||
});
|
||||
w.then(null, null, (a, b, c) => {
|
||||
// $ExpectType [never, never, never]
|
||||
// $ExpectType never
|
||||
a;
|
||||
// $ExpectType [never, never, never]
|
||||
// $ExpectType never
|
||||
b;
|
||||
// $ExpectType [never, never, never]
|
||||
// $ExpectType never
|
||||
c;
|
||||
});
|
||||
}
|
||||
@@ -4479,21 +4503,37 @@ function JQueryStatic() {
|
||||
const w = $.when(t, u);
|
||||
|
||||
w.then((a, b) => {
|
||||
// $ExpectType [string, SuccessTextStatus, jqXHR<string>]
|
||||
a;
|
||||
// $ExpectType [number, SuccessTextStatus, jqXHR<number>]
|
||||
b;
|
||||
// $ExpectType string
|
||||
a[0];
|
||||
// $ExpectType SuccessTextStatus
|
||||
a[1];
|
||||
// $ExpectType jqXHR<string>
|
||||
a[2];
|
||||
// $ExpectType number
|
||||
b[0];
|
||||
// $ExpectType SuccessTextStatus
|
||||
b[1];
|
||||
// $ExpectType jqXHR<number>
|
||||
b[2];
|
||||
});
|
||||
w.catch((a, b) => {
|
||||
// $ExpectType [jqXHR<string>, ErrorTextStatus, string]
|
||||
a;
|
||||
// $ExpectType [jqXHR<number>, ErrorTextStatus, string]
|
||||
b;
|
||||
// $ExpectType jqXHR<string>
|
||||
a[0];
|
||||
// $ExpectType ErrorTextStatus
|
||||
a[1];
|
||||
// $ExpectType string
|
||||
a[2];
|
||||
// $ExpectType jqXHR<number>
|
||||
b[0];
|
||||
// $ExpectType ErrorTextStatus
|
||||
b[1];
|
||||
// $ExpectType string
|
||||
b[2];
|
||||
});
|
||||
w.then(null, null, (a, b) => {
|
||||
// $ExpectType [never, never, never]
|
||||
// $ExpectType never
|
||||
a;
|
||||
// $ExpectType [never, never, never]
|
||||
// $ExpectType never
|
||||
b;
|
||||
});
|
||||
}
|
||||
@@ -4539,27 +4579,39 @@ function JQueryStatic() {
|
||||
const w = $.when(t, u, v);
|
||||
|
||||
w.then((a, b, c) => {
|
||||
// $ExpectType [string, boolean, never]
|
||||
a;
|
||||
// $ExpectType [string, boolean, never]
|
||||
b;
|
||||
// $ExpectType [string, boolean, never]
|
||||
c;
|
||||
// $ExpectType string
|
||||
a[0];
|
||||
// $ExpectType boolean
|
||||
a[1];
|
||||
// $ExpectType string
|
||||
b[0];
|
||||
// $ExpectType boolean
|
||||
b[1];
|
||||
// $ExpectType string
|
||||
c[0];
|
||||
// $ExpectType boolean
|
||||
c[1];
|
||||
});
|
||||
w.catch((a, b, c) => {
|
||||
// $ExpectType [Error, any, never]
|
||||
a;
|
||||
// $ExpectType [Error, any, never]
|
||||
b;
|
||||
// $ExpectType [Error, any, never]
|
||||
c;
|
||||
// $ExpectType Error
|
||||
a[0];
|
||||
// $ExpectType any
|
||||
a[1];
|
||||
// $ExpectType Error
|
||||
b[0];
|
||||
// $ExpectType any
|
||||
b[1];
|
||||
// $ExpectType Error
|
||||
c[0];
|
||||
// $ExpectType any
|
||||
c[1];
|
||||
});
|
||||
w.then(null, null, (a, b, c) => {
|
||||
// $ExpectType [number, any, never]
|
||||
// $ExpectType never
|
||||
a;
|
||||
// $ExpectType [number, any, never]
|
||||
// $ExpectType never
|
||||
b;
|
||||
// $ExpectType [number, any, never]
|
||||
// $ExpectType never
|
||||
c;
|
||||
});
|
||||
}
|
||||
@@ -4569,21 +4621,29 @@ function JQueryStatic() {
|
||||
const w = $.when(t, u);
|
||||
|
||||
w.then((a, b) => {
|
||||
// $ExpectType [string, boolean, never]
|
||||
a;
|
||||
// $ExpectType [string, boolean, never]
|
||||
b;
|
||||
// $ExpectType string
|
||||
a[0];
|
||||
// $ExpectType boolean
|
||||
a[1];
|
||||
// $ExpectType string
|
||||
b[0];
|
||||
// $ExpectType boolean
|
||||
b[1];
|
||||
});
|
||||
w.catch((a, b) => {
|
||||
// $ExpectType [Error, any, never]
|
||||
a;
|
||||
// $ExpectType [Error, any, never]
|
||||
b;
|
||||
// $ExpectType Error
|
||||
a[0];
|
||||
// $ExpectType any
|
||||
a[1];
|
||||
// $ExpectType Error
|
||||
b[0];
|
||||
// $ExpectType any
|
||||
b[1];
|
||||
});
|
||||
w.then(null, null, (a, b) => {
|
||||
// $ExpectType [number, any, never]
|
||||
// $ExpectType never
|
||||
a;
|
||||
// $ExpectType [number, any, never]
|
||||
// $ExpectType never
|
||||
b;
|
||||
});
|
||||
}
|
||||
@@ -4605,9 +4665,9 @@ function JQueryStatic() {
|
||||
b;
|
||||
});
|
||||
w.then(null, null, (a, b) => {
|
||||
// $ExpectType number
|
||||
// $ExpectType never
|
||||
a;
|
||||
// $ExpectType any
|
||||
// $ExpectType never
|
||||
b;
|
||||
});
|
||||
}
|
||||
@@ -4620,14 +4680,12 @@ function JQueryStatic() {
|
||||
// $ExpectType string
|
||||
value;
|
||||
});
|
||||
|
||||
w.catch(reason => {
|
||||
// $ExpectType Error
|
||||
reason;
|
||||
});
|
||||
|
||||
w.then(null, null, value => {
|
||||
// $ExpectType number
|
||||
// $ExpectType never
|
||||
value;
|
||||
});
|
||||
}
|
||||
@@ -4676,11 +4734,7 @@ function JQueryStatic() {
|
||||
}
|
||||
|
||||
$.when().then(() => {
|
||||
const f = first();
|
||||
// $ExpectType Promise<string, any, any>
|
||||
f;
|
||||
|
||||
return f;
|
||||
return first();
|
||||
}).then((value) => {
|
||||
// $ExpectType string
|
||||
value;
|
||||
@@ -4699,12 +4753,18 @@ function JQueryStatic() {
|
||||
const task2 = this.runTask2();
|
||||
const task3 = this.runTask3();
|
||||
|
||||
// $ExpectType Promise<One, any, any>
|
||||
task1;
|
||||
// $ExpectType Promise<Two, any, any>
|
||||
task2;
|
||||
// $ExpectType Promise<Three, any, any>
|
||||
task3;
|
||||
task1.then(value => {
|
||||
// $ExpectType One
|
||||
value;
|
||||
});
|
||||
task2.then(value => {
|
||||
// $ExpectType Two
|
||||
value;
|
||||
});
|
||||
task3.then(value => {
|
||||
// $ExpectType Three
|
||||
value;
|
||||
});
|
||||
|
||||
$.when(task1, task2, task3)
|
||||
.done((r1, r2, r3) => {
|
||||
|
||||
Reference in New Issue
Block a user