diff --git a/types/jquery/index.d.ts b/types/jquery/index.d.ts index 747abe207c..4ebb4692f5 100644 --- a/types/jquery/index.d.ts +++ b/types/jquery/index.d.ts @@ -6674,6 +6674,9 @@ declare namespace JQuery { progressFilter?: null): Promise3; + // PromiseLike compatibility + then(onfulfilled?: ((value: TR) => TResult1 | PromiseLike) | undefined | null, + onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): PromiseLike; /** * Add handlers to be called when the Deferred object is rejected. diff --git a/types/jquery/jquery-tests.ts b/types/jquery/jquery-tests.ts index b7bf78156c..01cc4a345e 100644 --- a/types/jquery/jquery-tests.ts +++ b/types/jquery/jquery-tests.ts @@ -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) {