diff --git a/types/jquery/README.md b/types/jquery/README.md
index d1bbad05fc..8fab451ce0 100644
--- a/types/jquery/README.md
+++ b/types/jquery/README.md
@@ -9,7 +9,7 @@ When jQuery is globally available, you can use `jQuery` and `$` directly.
When you want to import jQuery as a module and have a global DOM available (e.g. browser and browser-like environments):
```typescript
-import * as jQuery from 'jquery';
+import jQuery = require('jquery');
```
#### Importing (without a global DOM available)
@@ -23,6 +23,21 @@ const jQuery = jQueryFactory(window, true);
Note that while the factory function ignores the second parameter, it is required to get correct type declarations.
+### Project structure
+
+- [jquery-tests.ts](jquery-tests.ts)
+ - Tests that exercise TypeScript-specific usage and cases not covered by other test files.
+- [test/example-tests.ts](test/example-tests.ts)
+ - Tests generated from examples in jQuery documentation.
+- [test/longdesc-tests.ts](test/longdesc-tests.ts)
+ - Tests generated from non-example snippets in jQuery documentation.
+- [test/jquery-window-module-tests.ts](test/jquery-window-module-tests.ts)
+ [test/jquery-slim-window-module-tests.ts](test/jquery-slim-window-module-tests.ts)
+ - Tests importing jQuery with a DOM available
+- [test/jquery-no-window-module-tests.ts](test/jquery-no-window-module-tests.ts)
+ [test/jquery-slim-no-window-module-tests.ts](test/jquery-slim-no-window-module-tests.ts)
+ - Tests importing jQuery without a DOM available
+
### Authoring type definitions for jQuery plugins
`$.fn` is represented by `JQuery`.
diff --git a/types/jquery/index.d.ts b/types/jquery/index.d.ts
index 2c7d5ce75a..ce32477d98 100644
--- a/types/jquery/index.d.ts
+++ b/types/jquery/index.d.ts
@@ -62,7 +62,7 @@ interface JQuery {
* @see {@link https://api.jquery.com/add/}
* @since 1.4
*/
- add(selector: JQuery.Selector, context: Element): JQuery;
+ add(selector: JQuery.Selector, context: Element): this;
/**
* Create a new jQuery object with elements added to the set of matched elements.
*
@@ -74,7 +74,7 @@ interface JQuery {
* @since 1.0
* @since 1.3.2
*/
- add(selector: JQuery.Selector | JQuery.TypeOrArray | JQuery.htmlString | JQuery): JQuery;
+ add(selector: JQuery.Selector | JQuery.TypeOrArray | JQuery.htmlString | JQuery): this;
/**
* Add the previous set of elements on the stack to the current set, optionally filtered by a selector.
*
@@ -103,7 +103,7 @@ interface JQuery {
* @see {@link https://api.jquery.com/after/}
* @since 1.0
*/
- after(...contents: Array | JQuery>): this;
+ after(...contents: Array | JQuery>): this;
/**
* Insert content, specified by the parameter, after each element in the set of matched elements.
*
@@ -115,7 +115,7 @@ interface JQuery {
* @since 1.4
* @since 1.10
*/
- after(fn: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray | JQuery): this;
+ after(fn: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray | JQuery): this;
/**
* Register a handler to be called when Ajax requests complete. This is an AjaxEvent.
*
@@ -219,7 +219,7 @@ interface JQuery {
* @see {@link https://api.jquery.com/append/}
* @since 1.0
*/
- append(...contents: Array | JQuery>): this;
+ append(...contents: Array | JQuery>): this;
/**
* Insert content, specified by the parameter, to the end of each element in the set of matched elements.
*
@@ -230,7 +230,7 @@ interface JQuery {
* @see {@link https://api.jquery.com/append/}
* @since 1.4
*/
- append(fn: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray | JQuery): this;
+ append(fn: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray | JQuery): this;
/**
* Insert every element in the set of matched elements to the end of the target.
*
@@ -277,7 +277,7 @@ interface JQuery {
* @see {@link https://api.jquery.com/before/}
* @since 1.0
*/
- before(...contents: Array | JQuery>): this;
+ before(...contents: Array | JQuery>): this;
/**
* Insert content, specified by the parameter, before each element in the set of matched elements.
*
@@ -289,7 +289,7 @@ interface JQuery {
* @since 1.4
* @since 1.10
*/
- before(fn: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray | JQuery): this;
+ before(fn: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray | JQuery): this;
// [bind() overloads] https://github.com/jquery/api.jquery.com/issues/1048
/**
* Attach a handler to an event for the elements.
@@ -426,14 +426,14 @@ interface JQuery {
* @since 1.3
* @since 1.6
*/
- closest(selector: JQuery.Selector | JQuery | Element): this;
+ closest(selector: JQuery.Selector | Element | JQuery): this;
/**
* Get the children of each element in the set of matched elements, including text and comment nodes.
*
* @see {@link https://api.jquery.com/contents/}
* @since 1.2
*/
- contents(): this;
+ contents(): JQuery;
/**
* Bind an event handler to the "contextmenu" JavaScript event, or trigger that event on an element.
*
@@ -620,7 +620,7 @@ interface JQuery {
* @see {@link https://api.jquery.com/each/}
* @since 1.0
*/
- each(fn: (this: TElement, index: number, element: Element) => void | false): this;
+ each(fn: (this: TElement, index: number, element: TElement) => void | false): this;
/**
* Remove all child nodes of the set of matched elements from the DOM.
*
@@ -653,7 +653,7 @@ interface JQuery {
* @see {@link https://api.jquery.com/jQuery.fn.extend/}
* @since 1.0
*/
- extend(obj: object): JQuery;
+ extend(obj: object): this;
/**
* Display the matched elements by fading them to opaque.
*
@@ -796,7 +796,7 @@ interface JQuery {
* @since 1.0
* @since 1.6
*/
- find(selector: JQuery.Selector | Element | JQuery): JQuery;
+ find(selector: JQuery.Selector | Element | JQuery): this;
/**
* Stop the currently-running animation, remove all queued animations, and complete all animations for
* the matched elements.
@@ -985,7 +985,7 @@ interface JQuery {
* @since 1.0
* @since 1.4
*/
- index(element?: Element | JQuery | JQuery.Selector): number;
+ index(element?: JQuery.Selector | Element | JQuery): number;
/**
* Set the CSS inner height of each element in the set of matched elements.
*
@@ -1058,7 +1058,7 @@ interface JQuery {
* @since 1.0
* @since 1.6
*/
- is(selector: JQuery.Selector | ((this: TElement, index: number, element: TElement) => boolean) | JQuery | Element | Element[]): boolean;
+ is(selector: JQuery.Selector | JQuery.TypeOrArray | JQuery | ((this: TElement, index: number, element: TElement) => boolean)): boolean;
/**
* Bind an event handler to the "keydown" JavaScript event, or trigger that event on an element.
*
@@ -1148,7 +1148,7 @@ interface JQuery {
* @see {@link https://api.jquery.com/map/}
* @since 1.2
*/
- map(callback: (this: TElement, index: number, domElement: TElement) => any | any[] | null | undefined): JQuery;
+ map(callback: (this: TElement, index: number, domElement: TElement) => any | any[] | null | undefined): this;
/**
* Bind an event handler to the "mousedown" JavaScript event, or trigger that event on an element.
*
@@ -1309,7 +1309,7 @@ interface JQuery {
* @since 1.0
* @since 1.4
*/
- not(selector: JQuery.Selector | JQuery.TypeOrArray | ((this: TElement, index: number, element: TElement) => boolean) | JQuery): this;
+ not(selector: JQuery.Selector | JQuery.TypeOrArray | JQuery | ((this: TElement, index: number, element: TElement) => boolean)): this;
/**
* Remove an event handler.
*
@@ -1629,7 +1629,7 @@ interface JQuery {
* @see {@link https://api.jquery.com/prepend/}
* @since 1.0
*/
- prepend(...contents: Array | JQuery>): this;
+ prepend(...contents: Array | JQuery>): this;
/**
* Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.
*
@@ -1640,7 +1640,7 @@ interface JQuery {
* @see {@link https://api.jquery.com/prepend/}
* @since 1.4
*/
- prepend(fn: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray | JQuery): this;
+ prepend(fn: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray | JQuery): this;
/**
* Insert every element in the set of matched elements to the beginning of the target.
*
@@ -1688,7 +1688,7 @@ interface JQuery {
* @see {@link https://api.jquery.com/promise/}
* @since 1.6
*/
- promise(type: string, target: T): T & JQuery.Promise;
+ promise(type: string, target: T): T & JQuery.Promise;
/**
* Return a Promise object to observe when all actions of a certain type bound to the collection,
* queued or not, have finished.
@@ -1697,7 +1697,7 @@ interface JQuery {
* @see {@link https://api.jquery.com/promise/}
* @since 1.6
*/
- promise(target: T): T & JQuery.Promise;
+ promise(target: T): T & JQuery.Promise;
/**
* Return a Promise object to observe when all actions of a certain type bound to the collection,
* queued or not, have finished.
@@ -1751,7 +1751,7 @@ interface JQuery {
* @see {@link https://api.jquery.com/pushStack/}
* @since 1.3
*/
- pushStack(elements: ArrayLike, name: string, args: any[]): JQuery;
+ pushStack(elements: ArrayLike, name: string, args: any[]): this;
/**
* Add a collection of DOM elements onto the jQuery stack.
*
@@ -1759,7 +1759,7 @@ interface JQuery {
* @see {@link https://api.jquery.com/pushStack/}
* @since 1.0
*/
- pushStack(elements: ArrayLike): JQuery;
+ pushStack(elements: ArrayLike): this;
/**
* Manipulate the queue of functions to be executed, once for each matched element.
*
@@ -1858,7 +1858,7 @@ interface JQuery {
* @since 1.2
* @since 1.4
*/
- replaceWith(newContent: JQuery.htmlString | JQuery.TypeOrArray | JQuery | ((this: TElement) => any)): JQuery;
+ replaceWith(newContent: JQuery.htmlString | JQuery | JQuery.TypeOrArray | ((this: TElement) => any)): this;
/**
* Bind an event handler to the "resize" JavaScript event, or trigger that event on an element.
*
@@ -2388,7 +2388,7 @@ interface JQuery {
* @since 1.2
* @since 1.4
*/
- wrapInner(wrappingElement: JQuery.Selector | JQuery.htmlString | Element | JQuery | ((this: TElement, index: number) => string | Element | JQuery)): this;
+ wrapInner(wrappingElement: JQuery.Selector | JQuery.htmlString | Element | JQuery | ((this: TElement, index: number) => string | JQuery | Element)): this;
}
interface JQuery extends ArrayLike, Iterable { }
@@ -2411,7 +2411,7 @@ interface JQueryStatic {
* @since 1.4.3
*/
cssNumber: JQuery.PlainObject;
- readonly fn: JQuery;
+ readonly fn: JQuery;
fx: {
/**
* The rate (in milliseconds) at which animations fire.
@@ -2436,7 +2436,7 @@ interface JQueryStatic {
* @see {@link https://api.jquery.com/jQuery.ready/}
* @since 1.8
*/
- ready: JQuery.Thenable;
+ ready: JQuery.Thenable>;
/**
* A collection of properties that represent the presence of different browser features or bugs.
* Intended for jQuery's internal use; specific properties may be removed when they are no longer
@@ -2489,7 +2489,9 @@ interface JQueryStatic {
* @since 1.0
* @since 1.4
*/
- (selector_object_callback?: JQuery.Selector | JQuery.TypeOrArray | JQuery.PlainObject | JQuery | (($: JQueryStatic) => void)): JQuery;
+ (selector_object_callback?: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray | JQuery |
+ JQuery.PlainObject |
+ ((this: Document, $: JQueryStatic) => void)): JQuery;
/**
* A multi-purpose callbacks list object that provides a powerful way to manage callback lists.
*
@@ -2629,7 +2631,7 @@ interface JQueryStatic {
* @see {@link https://api.jquery.com/jQuery.each/}
* @since 1.0
*/
- each(array: ArrayLike, callback: (indexInArray: number, value: T) => false | any): ArrayLike;
+ each(array: ArrayLike, callback: (this: T, indexInArray: number, value: T) => false | any): ArrayLike;
/**
* A generic iterator function, which can be used to seamlessly iterate over both objects and arrays.
* Arrays and array-like objects with a length property (such as a function's arguments object) are
@@ -2640,7 +2642,7 @@ interface JQueryStatic {
* @see {@link https://api.jquery.com/jQuery.each/}
* @since 1.0
*/
- each(obj: T, callback: (propertyName: K, valueOfProperty: T[K]) => false | any): T;
+ each(obj: T, callback: (this: T[K], propertyName: K, valueOfProperty: T[K]) => false | any): T;
/**
* Takes a string and throws an exception containing it.
*
@@ -2648,7 +2650,7 @@ interface JQueryStatic {
* @see {@link https://api.jquery.com/jQuery.error/}
* @since 1.4.1
*/
- error(message: string): never;
+ error(message: string): any;
/**
* Escapes any character that has a special meaning in a CSS selector.
*
@@ -2719,7 +2721,7 @@ interface JQueryStatic {
* @see {@link https://api.jquery.com/jQuery.extend/}
* @since 1.1.4
*/
- extend(deep: true, target: T, ...objects: U[]): T & U;
+ extend(deep: true, target: any, object1: any, ...objects: any[]): any;
/**
* Merge the contents of two or more objects together into the first object.
*
@@ -2782,7 +2784,7 @@ interface JQueryStatic {
* @see {@link https://api.jquery.com/jQuery.extend/}
* @since 1.0
*/
- extend(target: T, ...objects: U[]): T & U;
+ extend(target: any, object1: any, ...objects: any[]): any;
/**
* Load data from the server using a HTTP GET request.
*
@@ -2835,7 +2837,7 @@ interface JQueryStatic {
* @since 1.12
* @since 2.2
*/
- get(url_settings?: string | JQuery.AjaxSettings): JQuery.jqXHR;
+ get(url_settings?: string | JQuery.UrlAjaxSettings): JQuery.jqXHR;
/**
* Load JSON-encoded data from the server using a GET HTTP request.
*
@@ -2868,7 +2870,7 @@ interface JQueryStatic {
* @since 1.0
*/
getScript(url: string,
- success?: JQuery.jqXHR.DoneCallback): JQuery.jqXHR;
+ success?: JQuery.jqXHR.DoneCallback): JQuery.jqXHR;
/**
* Execute some JavaScript code globally.
*
@@ -2915,7 +2917,7 @@ interface JQueryStatic {
* @see {@link https://api.jquery.com/jQuery.htmlPrefilter/}
* @since 1.12/2.2
*/
- htmlPrefilter(html: string): string;
+ htmlPrefilter(html: JQuery.htmlString): JQuery.htmlString;
/**
* Search for a specified value within an array and return its index (or -1 if not found).
*
@@ -3029,7 +3031,7 @@ interface JQueryStatic {
* @see {@link https://api.jquery.com/jQuery.noConflict/}
* @since 1.0
*/
- noConflict(removeAll?: boolean): JQueryStatic;
+ noConflict(removeAll?: boolean): this;
/**
* An empty function.
*
@@ -3065,7 +3067,7 @@ interface JQueryStatic {
* @see {@link https://api.jquery.com/jQuery.parseHTML/}
* @since 1.8
*/
- parseHTML(data: string, context: Document | null | undefined, keepScripts: boolean): Node[];
+ parseHTML(data: string, context: Document | null | undefined, keepScripts: boolean): JQuery.Node[];
/**
* Parses a string into an array of DOM nodes.
*
@@ -3075,7 +3077,7 @@ interface JQueryStatic {
* @see {@link https://api.jquery.com/jQuery.parseHTML/}
* @since 1.8
*/
- parseHTML(data: string, context_keepScripts?: Document | null | undefined | boolean): Node[];
+ parseHTML(data: string, context_keepScripts?: Document | null | undefined | boolean): JQuery.Node[];
/**
* Takes a well-formed JSON string and returns the resulting JavaScript value.
*
@@ -3145,7 +3147,7 @@ interface JQueryStatic {
* @since 1.12
* @since 2.2
*/
- post(url_settings?: string | JQuery.AjaxSettings): JQuery.jqXHR;
+ post(url_settings?: string | JQuery.UrlAjaxSettings): JQuery.jqXHR;
/**
* Takes a function and returns a new one that will always have a particular context.
*
@@ -3178,16 +3180,7 @@ interface JQueryStatic {
* @see {@link https://api.jquery.com/jQuery.queue/}
* @since 1.3
*/
- queue(element: Element, queueName: string, newQueue: JQuery.TypeOrArray>): JQuery;
- /**
- * Show the queue of functions to be executed on the matched element.
- *
- * @param element A DOM element to inspect for an attached queue.
- * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue.
- * @see {@link https://api.jquery.com/jQuery.queue/}
- * @since 1.3
- */
- queue(element: Element, queueName?: string): JQuery.Queue;
+ queue(element: T, queueName?: string, newQueue?: JQuery.TypeOrArray>): JQuery.Queue;
/**
* Handles errors thrown synchronously in functions wrapped in jQuery().
*
@@ -3204,7 +3197,7 @@ interface JQueryStatic {
* @see {@link https://api.jquery.com/jQuery.removeData/}
* @since 1.2.3
*/
- removeData(element: Element, name?: string): JQuery;
+ removeData(element: Element, name?: string): void;
/**
* Creates an object containing a set of properties ready to be used in the definition of custom animations.
*
@@ -3215,38 +3208,28 @@ interface JQueryStatic {
* @since 1.1
*/
speed(duration: JQuery.Duration, easing: string, complete: (this: TElement) => void): JQuery.EffectsOptions;
- /**
- * Creates an object containing a set of properties ready to be used in the definition of custom animations.
- *
- * @param easing A string indicating which easing function to use for the transition.
- * @param complete A function to call once the animation is complete, called once per matched element.
- * @see {@link https://api.jquery.com/jQuery.speed/}
- * @since 1.1
- */
- speed(easing: string, complete: (this: TElement) => void): JQuery.EffectsOptions;
/**
* Creates an object containing a set of properties ready to be used in the definition of custom animations.
*
* @param duration A string or number determining how long the animation will run.
- * @param easing_complete_settings A string indicating which easing function to use for the transition.
- * A function to call once the animation is complete, called once per matched element.
+ * @param easing_complete A string indicating which easing function to use for the transition.
+ * A function to call once the animation is complete, called once per matched element.
* @see {@link https://api.jquery.com/jQuery.speed/}
* @since 1.0
* @since 1.1
*/
speed(duration: JQuery.Duration,
- easing_complete_settings: string | ((this: TElement) => void) | JQuery.SpeedSettings): JQuery.EffectsOptions;
+ easing_complete: string | ((this: TElement) => void)): JQuery.EffectsOptions;
/**
* Creates an object containing a set of properties ready to be used in the definition of custom animations.
*
- * @param duration_easing_complete_settings A string or number determining how long the animation will run.
- * A string indicating which easing function to use for the transition.
- * A function to call once the animation is complete, called once per matched element.
+ * @param duration_complete_settings A string or number determining how long the animation will run.
+ * A function to call once the animation is complete, called once per matched element.
* @see {@link https://api.jquery.com/jQuery.speed/}
* @since 1.0
* @since 1.1
*/
- speed(duration_easing_complete_settings?: JQuery.Duration | string | ((this: TElement) => void) | JQuery.SpeedSettings): JQuery.EffectsOptions;
+ speed(duration_complete_settings?: JQuery.Duration | ((this: TElement) => void) | JQuery.SpeedSettings): JQuery.EffectsOptions;
/**
* Remove the whitespace from the beginning and end of a string.
*
@@ -3298,6 +3281,7 @@ interface JQueryStatic {
declare namespace JQuery {
type TypeOrArray = T | T[];
+ type Node = Element | Text | Comment;
/**
* A string is designated htmlString in jQuery documentation when it is used to represent one or more
@@ -3325,262 +3309,18 @@ declare namespace JQuery {
// region Ajax
- /**
- * @see {@link http://api.jquery.com/jquery.ajax/#jQuery-ajax-settings}
- */
- interface AjaxSettings {
- /**
- * A set of key/value pairs that map a given dataType to its MIME type, which gets sent in the Accept
- * request header. This header tells the server what kind of response it will accept in return.
- */
- accepts?: PlainObject;
- /**
- * By default, all requests are sent asynchronously (i.e. this is set to true by default). If you need
- * synchronous requests, set this option to false. Cross-domain requests and dataType: "jsonp" requests
- * do not support synchronous operation. Note that synchronous requests may temporarily lock the
- * browser, disabling any actions while the request is active. As of jQuery 1.8, the use of async:
- * false with jqXHR ($.Deferred) is deprecated; you must use the success/error/complete callback
- * options instead of the corresponding methods of the jqXHR object such as jqXHR.done().
- */
- async?: boolean;
- /**
- * A pre-request callback function that can be used to modify the jqXHR (in jQuery 1.4.x,
- * XMLHTTPRequest) object before it is sent. Use this to set custom headers, etc. The jqXHR and
- * settings objects are passed as arguments. This is an Ajax Event. Returning false in the beforeSend
- * function will cancel the request. As of jQuery 1.5, the beforeSend option will be called regardless
- * of the type of request.
- */
- beforeSend?(this: TContext, jqXHR: jqXHR, settings: AjaxSettings): false | void;
- /**
- * If set to false, it will force requested pages not to be cached by the browser. Note: Setting cache
- * to false will only work correctly with HEAD and GET requests. It works by appending "_={timestamp}"
- * to the GET parameters. The parameter is not needed for other types of requests, except in IE8 when a
- * POST is made to a URL that has already been requested by a GET.
- */
- cache?: boolean;
- /**
- * A function to be called when the request finishes (after success and error callbacks are executed).
- * The function gets passed two arguments: The jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object and a
- * string categorizing the status of the request ("success", "notmodified", "nocontent", "error",
- * "timeout", "abort", or "parsererror"). As of jQuery 1.5, the complete setting can accept an array of
- * functions. Each function will be called in turn. This is an Ajax Event.
- */
- complete?: TypeOrArray>;
- /**
- * An object of string/regular-expression pairs that determine how jQuery will parse the response,
- * given its content type.
- */
- contents?: PlainObject;
- /**
- * When sending data to the server, use this content type. Default is
- * "application/x-www-form-urlencoded; charset=UTF-8", which is fine for most cases. If you explicitly
- * pass in a content-type to $.ajax(), then it is always sent to the server (even if no data is sent).
- * As of jQuery 1.6 you can pass false to tell jQuery to not set any content type header. Note: The W3C
- * XMLHttpRequest specification dictates that the charset is always UTF-8; specifying another charset
- * will not force the browser to change the encoding. Note: For cross-domain requests, setting the
- * content type to anything other than application/x-www-form-urlencoded, multipart/form-data, or
- * text/plain will trigger the browser to send a preflight OPTIONS request to the server.
- */
- contentType?: string | false;
- /**
- * This object will be the context of all Ajax-related callbacks. By default, the context is an object
- * that represents the Ajax settings used in the call ($.ajaxSettings merged with the settings passed to $.ajax).
- */
- context?: TContext;
- /**
- * An object containing dataType-to-dataType converters. Each converter's value is a function that
- * returns the transformed value of the response.
- */
- converters?: PlainObject<((value: any) => any) | true>;
- /**
- * If you wish to force a crossDomain request (such as JSONP) on the same domain, set the value of
- * crossDomain to true. This allows, for example, server-side redirection to another domain.
- */
- crossDomain?: boolean;
- /**
- * Data to be sent to the server. It is converted to a query string, if not already a string. It's
- * appended to the url for GET-requests. See processData option to prevent this automatic processing.
- * Object must be Key/Value pairs. If value is an Array, jQuery serializes multiple values with same
- * key based on the value of the traditional setting (described below).
- */
- data?: PlainObject | string | any[];
- /**
- * A function to be used to handle the raw response data of XMLHttpRequest. This is a pre-filtering
- * function to sanitize the response. You should return the sanitized data. The function accepts two
- * arguments: The raw data returned from the server and the 'dataType' parameter.
- */
- dataFilter?(data: string, type: string): any;
- /**
- * The type of data that you're expecting back from the server. If none is specified, jQuery will try
- * to infer it based on the MIME type of the response (an XML MIME type will yield XML, in 1.4 JSON
- * will yield a JavaScript object, in 1.4 script will execute the script, and anything else will be
- * returned as a string). The available types (and the result passed as the first argument to your
- * success callback) are:
- *
- * "xml": Returns a XML document that can be processed via jQuery.
- *
- * "html": Returns HTML as plain text; included script tags are evaluated when inserted in the DOM.
- *
- * "script": Evaluates the response as JavaScript and returns it as plain text. Disables caching by
- * appending a query string parameter, _=[TIMESTAMP], to the URL unless the cache option is set to
- * true. Note: This will turn POSTs into GETs for remote-domain requests.
- *
- * "json": Evaluates the response as JSON and returns a JavaScript object. Cross-domain "json" requests
- * are converted to "jsonp" unless the request includes jsonp: false in its request options. The JSON
- * data is parsed in a strict manner; any malformed JSON is rejected and a parse error is thrown. As of
- * jQuery 1.9, an empty response is also rejected; the server should return a response of null or {}
- * instead. (See json.org for more information on proper JSON formatting.)
- *
- * "jsonp": Loads in a JSON block using JSONP. Adds an extra "?callback=?" to the end of your URL to
- * specify the callback. Disables caching by appending a query string parameter, "_=[TIMESTAMP]", to
- * the URL unless the cache option is set to true.
- *
- * "text": A plain text string.
- *
- * multiple, space-separated values: As of jQuery 1.5, jQuery can convert a dataType from what it
- * received in the Content-Type header to what you require. For example, if you want a text response to
- * be treated as XML, use "text xml" for the dataType. You can also make a JSONP request, have it
- * received as text, and interpreted by jQuery as XML: "jsonp text xml". Similarly, a shorthand string
- * such as "jsonp xml" will first attempt to convert from jsonp to xml, and, failing that, convert from
- * jsonp to text, and then from text to xml.
- */
- dataType?: 'xml' | 'html' | 'script' | 'json' | 'jsonp' | 'text' | string;
- /**
- * A function to be called if the request fails. The function receives three arguments: The jqXHR (in
- * jQuery 1.4.x, XMLHttpRequest) object, a string describing the type of error that occurred and an
- * optional exception object, if one occurred. Possible values for the second argument (besides null)
- * are "timeout", "error", "abort", and "parsererror". When an HTTP error occurs, errorThrown receives
- * the textual portion of the HTTP status, such as "Not Found" or "Internal Server Error." As of jQuery
- * 1.5, the error setting can accept an array of functions. Each function will be called in turn. Note:
- * This handler is not called for cross-domain script and cross-domain JSONP requests. This is an Ajax Event.
- */
- error?: TypeOrArray>;
- /**
- * Whether to trigger global Ajax event handlers for this request. The default is true. Set to false to
- * prevent the global handlers like ajaxStart or ajaxStop from being triggered. This can be used to
- * control various Ajax Events.
- */
- global?: boolean;
- /**
- * An object of additional header key/value pairs to send along with requests using the XMLHttpRequest
- * transport. The header X-Requested-With: XMLHttpRequest is always added, but its default
- * XMLHttpRequest value can be changed here. Values in the headers setting can also be overwritten from
- * within the beforeSend function.
- */
- headers?: PlainObject;
- /**
- * Allow the request to be successful only if the response has changed since the last request. This is
- * done by checking the Last-Modified header. Default value is false, ignoring the header. In jQuery
- * 1.4 this technique also checks the 'etag' specified by the server to catch unmodified data.
- */
- ifModified?: boolean;
- /**
- * Allow the current environment to be recognized as "local," (e.g. the filesystem), even if jQuery
- * does not recognize it as such by default. The following protocols are currently recognized as local:
- * file, *-extension, and widget. If the isLocal setting needs modification, it is recommended to do so
- * once in the $.ajaxSetup() method.
- */
- isLocal?: boolean;
- /**
- * Override the callback function name in a JSONP request. This value will be used instead of
- * 'callback' in the 'callback=?' part of the query string in the url. So {jsonp:'onJSONPLoad'} would
- * result in 'onJSONPLoad=?' passed to the server. As of jQuery 1.5, setting the jsonp option to false
- * prevents jQuery from adding the "?callback" string to the URL or attempting to use "=?" for
- * transformation. In this case, you should also explicitly set the jsonpCallback setting. For example,
- * { jsonp: false, jsonpCallback: "callbackName" }. If you don't trust the target of your Ajax
- * requests, consider setting the jsonp property to false for security reasons.
- */
- jsonp?: string | boolean;
- /**
- * Specify the callback function name for a JSONP request. This value will be used instead of the
- * random name automatically generated by jQuery. It is preferable to let jQuery generate a unique name
- * as it'll make it easier to manage the requests and provide callbacks and error handling. You may
- * want to specify the callback when you want to enable better browser caching of GET requests. As of
- * jQuery 1.5, you can also use a function for this setting, in which case the value of jsonpCallback
- * is set to the return value of that function.
- */
- jsonpCallback?: string | ((this: TContext) => string);
- /**
- * The HTTP method to use for the request (e.g. "POST", "GET", "PUT").
- */
- method?: string;
- /**
- * A mime type to override the XHR mime type.
- */
- mimeType?: string;
- /**
- * A password to be used with XMLHttpRequest in response to an HTTP access authentication request.
- */
- password?: string;
- /**
- * By default, data passed in to the data option as an object (technically, anything other than a
- * string) will be processed and transformed into a query string, fitting to the default content-type
- * "application/x-www-form-urlencoded". If you want to send a DOMDocument, or other non-processed data,
- * set this option to false.
- */
- processData?: boolean;
- /**
- * Only applies when the "script" transport is used (e.g., cross-domain requests with "jsonp" or
- * "script" dataType and "GET" type). Sets the charset attribute on the script tag used in the request.
- * Used when the character set on the local page is not the same as the one on the remote script.
- */
- scriptCharset?: string;
- /**
- * An object of numeric HTTP codes and functions to be called when the response has the corresponding
- * code.
- *
- * If the request is successful, the status code functions take the same parameters as the success
- * callback; if it results in an error (including 3xx redirect), they take the same parameters as the error callback.
- */
- statusCode?: PlainObject | Ajax.ErrorCallback>;
- /**
- * A function to be called if the request succeeds. The function gets passed three arguments: The data
- * returned from the server, formatted according to the dataType parameter or the dataFilter callback
- * function, if specified; a string describing the status; and the jqXHR (in jQuery 1.4.x,
- * XMLHttpRequest) object. As of jQuery 1.5, the success setting can accept an array of functions. Each
- * function will be called in turn. This is an Ajax Event.
- */
- success?: TypeOrArray>;
- /**
- * Set a timeout (in milliseconds) for the request. A value of 0 means there will be no timeout. This
- * will override any global timeout set with $.ajaxSetup(). The timeout period starts at the point the
- * $.ajax call is made; if several other requests are in progress and the browser has no connections
- * available, it is possible for a request to time out before it can be sent. In jQuery 1.4.x and
- * below, the XMLHttpRequest object will be in an invalid state if the request times out; accessing any
- * object members may throw an exception. In Firefox 3.0+ only, script and JSONP requests cannot be
- * cancelled by a timeout; the script will run even if it arrives after the timeout period.
- */
- timeout?: number;
- /**
- * Set this to true if you wish to use the traditional style of param serialization.
- */
- traditional?: boolean;
- /**
- * An alias for method. You should use type if you're using versions of jQuery prior to 1.9.0.
- */
- type?: string;
+ interface AjaxSettings extends Ajax.AjaxSettingsBase {
/**
* A string containing the URL to which the request is sent.
*/
url?: string;
+ }
+
+ interface UrlAjaxSettings extends Ajax.AjaxSettingsBase {
/**
- * A username to be used with XMLHttpRequest in response to an HTTP access authentication request.
+ * A string containing the URL to which the request is sent.
*/
- username?: string;
- /**
- * Callback for creating the XMLHttpRequest object. Defaults to the ActiveXObject when available (IE),
- * the XMLHttpRequest otherwise. Override to provide your own implementation for XMLHttpRequest or
- * enhancements to the factory.
- */
- xhr?(): XMLHttpRequest;
- /**
- * An object of fieldName-fieldValue pairs to set on the native XHR object.
- *
- * In jQuery 1.5, the withCredentials property was not propagated to the native XHR and thus CORS
- * requests requiring it would ignore this flag. For this reason, we recommend using jQuery 1.5.1+
- * should you require the use of it.
- */
- xhrFields?: PlainObject;
+ url: string;
}
namespace Ajax {
@@ -3593,12 +3333,421 @@ declare namespace JQuery {
}
interface ErrorCallback {
- (this: TContext, jqXHR: jqXHR, textStatus: ErrorTextStatus | null, errorThrown: string): void;
+ (this: TContext, jqXHR: jqXHR, textStatus: ErrorTextStatus, errorThrown: string): void;
}
interface CompleteCallback {
(this: TContext, jqXHR: jqXHR, textStatus: TextStatus): void;
}
+
+ /**
+ * @see {@link http://api.jquery.com/jquery.ajax/#jQuery-ajax-settings}
+ */
+ interface AjaxSettingsBase {
+ /**
+ * A set of key/value pairs that map a given dataType to its MIME type, which gets sent in the Accept
+ * request header. This header tells the server what kind of response it will accept in return.
+ */
+ accepts?: PlainObject;
+ /**
+ * By default, all requests are sent asynchronously (i.e. this is set to true by default). If you need
+ * synchronous requests, set this option to false. Cross-domain requests and dataType: "jsonp" requests
+ * do not support synchronous operation. Note that synchronous requests may temporarily lock the
+ * browser, disabling any actions while the request is active. As of jQuery 1.8, the use of async:
+ * false with jqXHR ($.Deferred) is deprecated; you must use the success/error/complete callback
+ * options instead of the corresponding methods of the jqXHR object such as jqXHR.done().
+ */
+ async?: boolean;
+ /**
+ * A pre-request callback function that can be used to modify the jqXHR (in jQuery 1.4.x,
+ * XMLHTTPRequest) object before it is sent. Use this to set custom headers, etc. The jqXHR and
+ * settings objects are passed as arguments. This is an Ajax Event. Returning false in the beforeSend
+ * function will cancel the request. As of jQuery 1.5, the beforeSend option will be called regardless
+ * of the type of request.
+ */
+ beforeSend?(this: TContext, jqXHR: jqXHR, settings: AjaxSettingsBase): false | void;
+ /**
+ * If set to false, it will force requested pages not to be cached by the browser. Note: Setting cache
+ * to false will only work correctly with HEAD and GET requests. It works by appending "_={timestamp}"
+ * to the GET parameters. The parameter is not needed for other types of requests, except in IE8 when a
+ * POST is made to a URL that has already been requested by a GET.
+ */
+ cache?: boolean;
+ /**
+ * A function to be called when the request finishes (after success and error callbacks are executed).
+ * The function gets passed two arguments: The jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object and a
+ * string categorizing the status of the request ("success", "notmodified", "nocontent", "error",
+ * "timeout", "abort", or "parsererror"). As of jQuery 1.5, the complete setting can accept an array of
+ * functions. Each function will be called in turn. This is an Ajax Event.
+ */
+ complete?: TypeOrArray>;
+ /**
+ * An object of string/regular-expression pairs that determine how jQuery will parse the response,
+ * given its content type.
+ */
+ contents?: PlainObject;
+ /**
+ * When sending data to the server, use this content type. Default is
+ * "application/x-www-form-urlencoded; charset=UTF-8", which is fine for most cases. If you explicitly
+ * pass in a content-type to $.ajax(), then it is always sent to the server (even if no data is sent).
+ * As of jQuery 1.6 you can pass false to tell jQuery to not set any content type header. Note: The W3C
+ * XMLHttpRequest specification dictates that the charset is always UTF-8; specifying another charset
+ * will not force the browser to change the encoding. Note: For cross-domain requests, setting the
+ * content type to anything other than application/x-www-form-urlencoded, multipart/form-data, or
+ * text/plain will trigger the browser to send a preflight OPTIONS request to the server.
+ */
+ contentType?: string | false;
+ /**
+ * This object will be the context of all Ajax-related callbacks. By default, the context is an object
+ * that represents the Ajax settings used in the call ($.ajaxSettings merged with the settings passed to $.ajax).
+ */
+ context?: TContext;
+ /**
+ * An object containing dataType-to-dataType converters. Each converter's value is a function that
+ * returns the transformed value of the response.
+ */
+ converters?: PlainObject<((value: any) => any) | true>;
+ /**
+ * If you wish to force a crossDomain request (such as JSONP) on the same domain, set the value of
+ * crossDomain to true. This allows, for example, server-side redirection to another domain.
+ */
+ crossDomain?: boolean;
+ /**
+ * Data to be sent to the server. It is converted to a query string, if not already a string. It's
+ * appended to the url for GET-requests. See processData option to prevent this automatic processing.
+ * Object must be Key/Value pairs. If value is an Array, jQuery serializes multiple values with same
+ * key based on the value of the traditional setting (described below).
+ */
+ data?: PlainObject | string;
+ /**
+ * A function to be used to handle the raw response data of XMLHttpRequest. This is a pre-filtering
+ * function to sanitize the response. You should return the sanitized data. The function accepts two
+ * arguments: The raw data returned from the server and the 'dataType' parameter.
+ */
+ dataFilter?(data: string, type: string): any;
+ /**
+ * The type of data that you're expecting back from the server. If none is specified, jQuery will try
+ * to infer it based on the MIME type of the response (an XML MIME type will yield XML, in 1.4 JSON
+ * will yield a JavaScript object, in 1.4 script will execute the script, and anything else will be
+ * returned as a string). The available types (and the result passed as the first argument to your
+ * success callback) are:
+ *
+ * "xml": Returns a XML document that can be processed via jQuery.
+ *
+ * "html": Returns HTML as plain text; included script tags are evaluated when inserted in the DOM.
+ *
+ * "script": Evaluates the response as JavaScript and returns it as plain text. Disables caching by
+ * appending a query string parameter, _=[TIMESTAMP], to the URL unless the cache option is set to
+ * true. Note: This will turn POSTs into GETs for remote-domain requests.
+ *
+ * "json": Evaluates the response as JSON and returns a JavaScript object. Cross-domain "json" requests
+ * are converted to "jsonp" unless the request includes jsonp: false in its request options. The JSON
+ * data is parsed in a strict manner; any malformed JSON is rejected and a parse error is thrown. As of
+ * jQuery 1.9, an empty response is also rejected; the server should return a response of null or {}
+ * instead. (See json.org for more information on proper JSON formatting.)
+ *
+ * "jsonp": Loads in a JSON block using JSONP. Adds an extra "?callback=?" to the end of your URL to
+ * specify the callback. Disables caching by appending a query string parameter, "_=[TIMESTAMP]", to
+ * the URL unless the cache option is set to true.
+ *
+ * "text": A plain text string.
+ *
+ * multiple, space-separated values: As of jQuery 1.5, jQuery can convert a dataType from what it
+ * received in the Content-Type header to what you require. For example, if you want a text response to
+ * be treated as XML, use "text xml" for the dataType. You can also make a JSONP request, have it
+ * received as text, and interpreted by jQuery as XML: "jsonp text xml". Similarly, a shorthand string
+ * such as "jsonp xml" will first attempt to convert from jsonp to xml, and, failing that, convert from
+ * jsonp to text, and then from text to xml.
+ */
+ dataType?: 'xml' | 'html' | 'script' | 'json' | 'jsonp' | 'text' | string;
+ /**
+ * A function to be called if the request fails. The function receives three arguments: The jqXHR (in
+ * jQuery 1.4.x, XMLHttpRequest) object, a string describing the type of error that occurred and an
+ * optional exception object, if one occurred. Possible values for the second argument (besides null)
+ * are "timeout", "error", "abort", and "parsererror". When an HTTP error occurs, errorThrown receives
+ * the textual portion of the HTTP status, such as "Not Found" or "Internal Server Error." As of jQuery
+ * 1.5, the error setting can accept an array of functions. Each function will be called in turn. Note:
+ * This handler is not called for cross-domain script and cross-domain JSONP requests. This is an Ajax Event.
+ */
+ error?: TypeOrArray>;
+ /**
+ * Whether to trigger global Ajax event handlers for this request. The default is true. Set to false to
+ * prevent the global handlers like ajaxStart or ajaxStop from being triggered. This can be used to
+ * control various Ajax Events.
+ */
+ global?: boolean;
+ /**
+ * An object of additional header key/value pairs to send along with requests using the XMLHttpRequest
+ * transport. The header X-Requested-With: XMLHttpRequest is always added, but its default
+ * XMLHttpRequest value can be changed here. Values in the headers setting can also be overwritten from
+ * within the beforeSend function.
+ */
+ headers?: PlainObject;
+ /**
+ * Allow the request to be successful only if the response has changed since the last request. This is
+ * done by checking the Last-Modified header. Default value is false, ignoring the header. In jQuery
+ * 1.4 this technique also checks the 'etag' specified by the server to catch unmodified data.
+ */
+ ifModified?: boolean;
+ /**
+ * Allow the current environment to be recognized as "local," (e.g. the filesystem), even if jQuery
+ * does not recognize it as such by default. The following protocols are currently recognized as local:
+ * file, *-extension, and widget. If the isLocal setting needs modification, it is recommended to do so
+ * once in the $.ajaxSetup() method.
+ */
+ isLocal?: boolean;
+ /**
+ * Override the callback function name in a JSONP request. This value will be used instead of
+ * 'callback' in the 'callback=?' part of the query string in the url. So {jsonp:'onJSONPLoad'} would
+ * result in 'onJSONPLoad=?' passed to the server. As of jQuery 1.5, setting the jsonp option to false
+ * prevents jQuery from adding the "?callback" string to the URL or attempting to use "=?" for
+ * transformation. In this case, you should also explicitly set the jsonpCallback setting. For example,
+ * { jsonp: false, jsonpCallback: "callbackName" }. If you don't trust the target of your Ajax
+ * requests, consider setting the jsonp property to false for security reasons.
+ */
+ jsonp?: string | false;
+ /**
+ * Specify the callback function name for a JSONP request. This value will be used instead of the
+ * random name automatically generated by jQuery. It is preferable to let jQuery generate a unique name
+ * as it'll make it easier to manage the requests and provide callbacks and error handling. You may
+ * want to specify the callback when you want to enable better browser caching of GET requests. As of
+ * jQuery 1.5, you can also use a function for this setting, in which case the value of jsonpCallback
+ * is set to the return value of that function.
+ */
+ jsonpCallback?: string | ((this: TContext) => string);
+ /**
+ * The HTTP method to use for the request (e.g. "POST", "GET", "PUT").
+ */
+ method?: string;
+ /**
+ * A mime type to override the XHR mime type.
+ */
+ mimeType?: string;
+ /**
+ * A password to be used with XMLHttpRequest in response to an HTTP access authentication request.
+ */
+ password?: string;
+ /**
+ * By default, data passed in to the data option as an object (technically, anything other than a
+ * string) will be processed and transformed into a query string, fitting to the default content-type
+ * "application/x-www-form-urlencoded". If you want to send a DOMDocument, or other non-processed data,
+ * set this option to false.
+ */
+ processData?: boolean;
+ /**
+ * Only applies when the "script" transport is used (e.g., cross-domain requests with "jsonp" or
+ * "script" dataType and "GET" type). Sets the charset attribute on the script tag used in the request.
+ * Used when the character set on the local page is not the same as the one on the remote script.
+ */
+ scriptCharset?: string;
+ /**
+ * An object of numeric HTTP codes and functions to be called when the response has the corresponding
+ * code.
+ *
+ * If the request is successful, the status code functions take the same parameters as the success
+ * callback; if it results in an error (including 3xx redirect), they take the same parameters as the error callback.
+ */
+ statusCode?: StatusCodeCallbacks;
+ /**
+ * A function to be called if the request succeeds. The function gets passed three arguments: The data
+ * returned from the server, formatted according to the dataType parameter or the dataFilter callback
+ * function, if specified; a string describing the status; and the jqXHR (in jQuery 1.4.x,
+ * XMLHttpRequest) object. As of jQuery 1.5, the success setting can accept an array of functions. Each
+ * function will be called in turn. This is an Ajax Event.
+ */
+ success?: TypeOrArray>;
+ /**
+ * Set a timeout (in milliseconds) for the request. A value of 0 means there will be no timeout. This
+ * will override any global timeout set with $.ajaxSetup(). The timeout period starts at the point the
+ * $.ajax call is made; if several other requests are in progress and the browser has no connections
+ * available, it is possible for a request to time out before it can be sent. In jQuery 1.4.x and
+ * below, the XMLHttpRequest object will be in an invalid state if the request times out; accessing any
+ * object members may throw an exception. In Firefox 3.0+ only, script and JSONP requests cannot be
+ * cancelled by a timeout; the script will run even if it arrives after the timeout period.
+ */
+ timeout?: number;
+ /**
+ * Set this to true if you wish to use the traditional style of param serialization.
+ */
+ traditional?: boolean;
+ /**
+ * An alias for method. You should use type if you're using versions of jQuery prior to 1.9.0.
+ */
+ type?: string;
+ /**
+ * A username to be used with XMLHttpRequest in response to an HTTP access authentication request.
+ */
+ username?: string;
+ /**
+ * Callback for creating the XMLHttpRequest object. Defaults to the ActiveXObject when available (IE),
+ * the XMLHttpRequest otherwise. Override to provide your own implementation for XMLHttpRequest or
+ * enhancements to the factory.
+ */
+ xhr?(): XMLHttpRequest;
+ /**
+ * An object of fieldName-fieldValue pairs to set on the native XHR object.
+ *
+ * In jQuery 1.5, the withCredentials property was not propagated to the native XHR and thus CORS
+ * requests requiring it would ignore this flag. For this reason, we recommend using jQuery 1.5.1+
+ * should you require the use of it.
+ */
+ xhrFields?: PlainObject;
+ }
+
+ // Status codes not listed require type annotations when defining the callback
+ type StatusCodeCallbacks = {
+ // jQuery treats 2xx and 304 status codes as a success
+ 200?: SuccessCallback;
+ 201?: SuccessCallback;
+ 202?: SuccessCallback;
+ 203?: SuccessCallback;
+ 204?: SuccessCallback;
+ 205?: SuccessCallback;
+ 206?: SuccessCallback;
+ 207?: SuccessCallback;
+ 208?: SuccessCallback;
+ 209?: SuccessCallback;
+ 210?: SuccessCallback;
+ 211?: SuccessCallback;
+ 212?: SuccessCallback;
+ 213?: SuccessCallback;
+ 214?: SuccessCallback;
+ 215?: SuccessCallback;
+ 216?: SuccessCallback;
+ 217?: SuccessCallback;
+ 218?: SuccessCallback;
+ 219?: SuccessCallback;
+ 220?: SuccessCallback;
+ 221?: SuccessCallback;
+ 222?: SuccessCallback;
+ 223?: SuccessCallback;
+ 224?: SuccessCallback;
+ 225?: SuccessCallback;
+ 226?: SuccessCallback;
+ 227?: SuccessCallback;
+ 228?: SuccessCallback;
+ 229?: SuccessCallback;
+ 230?: SuccessCallback;
+ 231?: SuccessCallback;
+ 232?: SuccessCallback;
+ 233?: SuccessCallback;
+ 234?: SuccessCallback;
+ 235?: SuccessCallback;
+ 236?: SuccessCallback;
+ 237?: SuccessCallback;
+ 238?: SuccessCallback;
+ 239?: SuccessCallback;
+ 240?: SuccessCallback;
+ 241?: SuccessCallback;
+ 242?: SuccessCallback;
+ 243?: SuccessCallback;
+ 244?: SuccessCallback;
+ 245?: SuccessCallback;
+ 246?: SuccessCallback;
+ 247?: SuccessCallback;
+ 248?: SuccessCallback;
+ 249?: SuccessCallback;
+ 250?: SuccessCallback;
+ 251?: SuccessCallback;
+ 252?: SuccessCallback;
+ 253?: SuccessCallback;
+ 254?: SuccessCallback;
+ 255?: SuccessCallback;
+ 256?: SuccessCallback;
+ 257?: SuccessCallback;
+ 258?: SuccessCallback;
+ 259?: SuccessCallback;
+ 260?: SuccessCallback;
+ 261?: SuccessCallback;
+ 262?: SuccessCallback;
+ 263?: SuccessCallback;
+ 264?: SuccessCallback;
+ 265?: SuccessCallback;
+ 266?: SuccessCallback;
+ 267?: SuccessCallback;
+ 268?: SuccessCallback;
+ 269?: SuccessCallback;
+ 270?: SuccessCallback;
+ 271?: SuccessCallback;
+ 272?: SuccessCallback;
+ 273?: SuccessCallback;
+ 274?: SuccessCallback;
+ 275?: SuccessCallback;
+ 276?: SuccessCallback;
+ 277?: SuccessCallback;
+ 278?: SuccessCallback;
+ 279?: SuccessCallback;
+ 280?: SuccessCallback;
+ 281?: SuccessCallback;
+ 282?: SuccessCallback;
+ 283?: SuccessCallback;
+ 284?: SuccessCallback;
+ 285?: SuccessCallback;
+ 286?: SuccessCallback;
+ 287?: SuccessCallback;
+ 288?: SuccessCallback;
+ 289?: SuccessCallback;
+ 290?: SuccessCallback;
+ 291?: SuccessCallback;
+ 292?: SuccessCallback;
+ 293?: SuccessCallback;
+ 294?: SuccessCallback;
+ 295?: SuccessCallback;
+ 296?: SuccessCallback;
+ 297?: SuccessCallback;
+ 298?: SuccessCallback;
+ 299?: SuccessCallback;
+ 304?: SuccessCallback;
+
+ // Standard 3xx, 4xx, and 5xx status codes that are considered an error
+ 300?: ErrorCallback;
+ 301?: ErrorCallback;
+ 302?: ErrorCallback