mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 04:49:15 +08:00
[jquery] Fix PromiseLike compatibility for Promise3, Promise2, and jqXHR.
This commit is contained in:
3
types/jquery/index.d.ts
vendored
3
types/jquery/index.d.ts
vendored
@@ -6674,6 +6674,9 @@ declare namespace JQuery {
|
||||
progressFilter?: null): Promise3<ARD, AJD, AND,
|
||||
BRD, BJD, BND,
|
||||
CRD, CJD, CND>;
|
||||
// PromiseLike compatibility
|
||||
then<TResult1 = TR, TResult2 = never>(onfulfilled?: ((value: TR) => TResult1 | PromiseLike<TResult1>) | undefined | null,
|
||||
onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): PromiseLike<TResult1 | TResult2>;
|
||||
|
||||
/**
|
||||
* Add handlers to be called when the Deferred object is rejected.
|
||||
|
||||
@@ -7138,6 +7138,13 @@ function Promise3() {
|
||||
return $.ajax('/echo/json');
|
||||
});
|
||||
}
|
||||
|
||||
// As argument to PromiseLike parameter
|
||||
{
|
||||
Promise.resolve(p).then(a => {
|
||||
a; // $ExpectType string
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function Promise2(p: JQuery.Promise2<string, Error, number, JQuery, string, boolean>) {
|
||||
|
||||
Reference in New Issue
Block a user