[jquery] Fix PromiseLike compatibility for Promise3, Promise2, and jqXHR.

This commit is contained in:
Leonard Thieu
2017-07-12 20:07:43 -04:00
parent 444664dd77
commit 8c92375cfd
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>) {