Merge pull request #18002 from leonard-thieu/jquery

[jquery] Fix PromiseLike compatibility for Promise3, Promise2, and jqXHR
This commit is contained in:
Ryan Cavanaugh
2017-07-13 19:04:18 -07:00
committed by GitHub
2 changed files with 10 additions and 0 deletions

View File

@@ -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.

View File

@@ -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>) {