mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-19 05:03:32 +08:00
Merge pull request #8374 from vagarenko/master
JQuery: make JQueryXHR.then method generic.
This commit is contained in:
@@ -199,6 +199,11 @@ function test_ajax() {
|
||||
console.log(jqXHR, textStatus, errorThrown);
|
||||
});
|
||||
|
||||
// generic then method
|
||||
var p: JQueryPromise<number> = $.ajax({ url: "test.js" })
|
||||
.then(() => "Hello")
|
||||
.then((x) => x.length);
|
||||
|
||||
// jqXHR object
|
||||
var jqXHR = $.ajax({
|
||||
url: "test.js"
|
||||
|
||||
2
jquery/jquery.d.ts
vendored
2
jquery/jquery.d.ts
vendored
@@ -180,7 +180,7 @@ interface JQueryXHR extends XMLHttpRequest, JQueryPromise<any> {
|
||||
/**
|
||||
* Incorporates the functionality of the .done() and .fail() methods, allowing (as of jQuery 1.8) the underlying Promise to be manipulated. Refer to deferred.then() for implementation details.
|
||||
*/
|
||||
then(doneCallback: (data: any, textStatus: string, jqXHR: JQueryXHR) => void, failCallback?: (jqXHR: JQueryXHR, textStatus: string, errorThrown: any) => void): JQueryPromise<any>;
|
||||
then<R>(doneCallback: (data: any, textStatus: string, jqXHR: JQueryXHR) => R, failCallback?: (jqXHR: JQueryXHR, textStatus: string, errorThrown: any) => void): JQueryPromise<R>;
|
||||
/**
|
||||
* Property containing the parsed response if the response Content-Type is json
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user