Merge pull request #3479 from johnnyreilly/master

jQuery: Started replacing overloads with union types
This commit is contained in:
John Reilly
2015-01-18 07:45:38 +00:00

308
jquery/jquery.d.ts vendored
View File

@@ -743,16 +743,7 @@ interface JQueryStatic {
* @param success A callback function that is executed if the request succeeds.
* @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html).
*/
get(url: string, data?: Object, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR;
/**
* Load data from the server using a HTTP GET request.
*
* @param url A string containing the URL to which the request is sent.
* @param data A plain object or string that is sent to the server with the request.
* @param success A callback function that is executed if the request succeeds.
* @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html).
*/
get(url: string, data?: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR;
get(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR;
/**
* Load JSON-encoded data from the server using a GET HTTP request.
*
@@ -767,15 +758,7 @@ interface JQueryStatic {
* @param data A plain object or string that is sent to the server with the request.
* @param success A callback function that is executed if the request succeeds.
*/
getJSON(url: string, data?: Object, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR;
/**
* Load JSON-encoded data from the server using a GET HTTP request.
*
* @param url A string containing the URL to which the request is sent.
* @param data A plain object or string that is sent to the server with the request.
* @param success A callback function that is executed if the request succeeds.
*/
getJSON(url: string, data?: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR;
getJSON(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR;
/**
* Load a JavaScript file from the server using a GET HTTP request, then execute it.
*
@@ -805,16 +788,7 @@ interface JQueryStatic {
* @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case.
* @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html).
*/
post(url: string, data?: Object, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR;
/**
* Load data from the server using a HTTP POST request.
*
* @param url A string containing the URL to which the request is sent.
* @param data A plain object or string that is sent to the server with the request.
* @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case.
* @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html).
*/
post(url: string, data?: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR;
post(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR;
/**
* A multi-purpose callbacks list object that provides a powerful way to manage callback lists.
@@ -836,14 +810,7 @@ interface JQueryStatic {
* @param selector A string containing a selector expression
* @param context A DOM Element, Document, or jQuery to use as context
*/
(selector: string, context?: Element): JQuery;
/**
* Accepts a string containing a CSS selector which is then used to match a set of elements.
*
* @param selector A string containing a selector expression
* @param context A DOM Element, Document, or jQuery to use as context
*/
(selector: string, context?: JQuery): JQuery;
(selector: string, context?: Element|JQuery): JQuery;
/**
* Accepts a string containing a CSS selector which is then used to match a set of elements.
*
@@ -1313,15 +1280,7 @@ interface JQuery {
* @param data A plain object or string that is sent to the server with the request.
* @param complete A callback function that is executed when the request completes.
*/
load(url: string, data?: string, complete?: (responseText: string, textStatus: string, XMLHttpRequest: XMLHttpRequest) => any): JQuery;
/**
* Load data from the server and place the returned HTML into the matched element.
*
* @param url A string containing the URL to which the request is sent.
* @param data A plain object or string that is sent to the server with the request.
* @param complete A callback function that is executed when the request completes.
*/
load(url: string, data?: Object, complete?: (responseText: string, textStatus: string, XMLHttpRequest: XMLHttpRequest) => any): JQuery;
load(url: string, data?: string|Object, complete?: (responseText: string, textStatus: string, XMLHttpRequest: XMLHttpRequest) => any): JQuery;
/**
* Encode a set of form elements as a string for submission.
@@ -1661,14 +1620,7 @@ interface JQuery {
*
* @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string).
*/
innerHeight(height: number): JQuery;
/**
* Sets the inner height on elements in the set of matched elements, including padding but not border.
*
* @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string).
*/
innerHeight(height: string): JQuery;
innerHeight(height: number|string): JQuery;
/**
* Get the current computed width for the first element in the set of matched elements, including padding but not border.
@@ -1680,14 +1632,7 @@ interface JQuery {
*
* @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string).
*/
innerWidth(width: number): JQuery;
/**
* Sets the inner width on elements in the set of matched elements, including padding but not border.
*
* @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string).
*/
innerWidth(width: string): JQuery;
innerWidth(width: number|string): JQuery;
/**
* Get the current coordinates of the first element in the set of matched elements, relative to the document.
@@ -1718,15 +1663,8 @@ interface JQuery {
*
* @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string).
*/
outerHeight(height: number): JQuery;
outerHeight(height: number|string): JQuery;
/**
* Sets the outer height on elements in the set of matched elements, including padding and border.
*
* @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string).
*/
outerHeight(height: string): JQuery;
/**
* Get the current computed width for the first element in the set of matched elements, including padding and border.
*
@@ -1739,14 +1677,7 @@ interface JQuery {
*
* @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string).
*/
outerWidth(width: number): JQuery;
/**
* Sets the outer width on elements in the set of matched elements, including padding and border.
*
* @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string).
*/
outerWidth(width: string): JQuery;
outerWidth(width: number|string): JQuery;
/**
* Get the current coordinates of the first element in the set of matched elements, relative to the offset parent.
@@ -1784,13 +1715,7 @@ interface JQuery {
*
* @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string).
*/
width(value: number): JQuery;
/**
* Set the CSS width of each element in the set of matched elements.
*
* @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string).
*/
width(value: string): JQuery;
width(value: number|string): JQuery;
/**
* Set the CSS width of each element in the set of matched elements.
*
@@ -1882,15 +1807,7 @@ interface JQuery {
* @param duration A string or number determining how long the animation will run.
* @param complete A function to call once the animation is complete.
*/
animate(properties: Object, duration?: string, complete?: Function): JQuery;
/**
* Perform a custom animation of a set of CSS properties.
*
* @param properties An object of CSS properties and values that the animation will move toward.
* @param duration A string or number determining how long the animation will run.
* @param complete A function to call once the animation is complete.
*/
animate(properties: Object, duration?: number, complete?: Function): JQuery;
animate(properties: Object, duration?: string|number, complete?: Function): JQuery;
/**
* Perform a custom animation of a set of CSS properties.
*
@@ -1899,16 +1816,7 @@ interface JQuery {
* @param easing A string indicating which easing function to use for the transition. (default: swing)
* @param complete A function to call once the animation is complete.
*/
animate(properties: Object, duration?: string, easing?: string, complete?: Function): JQuery;
/**
* Perform a custom animation of a set of CSS properties.
*
* @param properties An object of CSS properties and values that the animation will move toward.
* @param duration A string or number determining how long the animation will run.
* @param easing A string indicating which easing function to use for the transition. (default: swing)
* @param complete A function to call once the animation is complete.
*/
animate(properties: Object, duration?: number, easing?: string, complete?: Function): JQuery;
animate(properties: Object, duration?: string|number, easing?: string, complete?: Function): JQuery;
/**
* Perform a custom animation of a set of CSS properties.
*
@@ -1931,14 +1839,7 @@ interface JQuery {
* @param duration A string or number determining how long the animation will run.
* @param complete A function to call once the animation is complete.
*/
fadeIn(duration?: number, complete?: Function): JQuery;
/**
* Display the matched elements by fading them to opaque.
*
* @param duration A string or number determining how long the animation will run.
* @param complete A function to call once the animation is complete.
*/
fadeIn(duration?: string, complete?: Function): JQuery;
fadeIn(duration?: number|string, complete?: Function): JQuery;
/**
* Display the matched elements by fading them to opaque.
*
@@ -1946,15 +1847,7 @@ interface JQuery {
* @param easing A string indicating which easing function to use for the transition.
* @param complete A function to call once the animation is complete.
*/
fadeIn(duration?: number, easing?: string, complete?: Function): JQuery;
/**
* Display the matched elements by fading them to opaque.
*
* @param duration A string or number determining how long the animation will run.
* @param easing A string indicating which easing function to use for the transition.
* @param complete A function to call once the animation is complete.
*/
fadeIn(duration?: string, easing?: string, complete?: Function): JQuery;
fadeIn(duration?: number|string, easing?: string, complete?: Function): JQuery;
/**
* Display the matched elements by fading them to opaque.
*
@@ -1968,14 +1861,7 @@ interface JQuery {
* @param duration A string or number determining how long the animation will run.
* @param complete A function to call once the animation is complete.
*/
fadeOut(duration?: number, complete?: Function): JQuery;
/**
* Hide the matched elements by fading them to transparent.
*
* @param duration A string or number determining how long the animation will run.
* @param complete A function to call once the animation is complete.
*/
fadeOut(duration?: string, complete?: Function): JQuery;
fadeOut(duration?: number|string, complete?: Function): JQuery;
/**
* Hide the matched elements by fading them to transparent.
*
@@ -1983,15 +1869,7 @@ interface JQuery {
* @param easing A string indicating which easing function to use for the transition.
* @param complete A function to call once the animation is complete.
*/
fadeOut(duration?: number, easing?: string, complete?: Function): JQuery;
/**
* Hide the matched elements by fading them to transparent.
*
* @param duration A string or number determining how long the animation will run.
* @param easing A string indicating which easing function to use for the transition.
* @param complete A function to call once the animation is complete.
*/
fadeOut(duration?: string, easing?: string, complete?: Function): JQuery;
fadeOut(duration?: number|string, easing?: string, complete?: Function): JQuery;
/**
* Hide the matched elements by fading them to transparent.
*
@@ -2006,15 +1884,7 @@ interface JQuery {
* @param opacity A number between 0 and 1 denoting the target opacity.
* @param complete A function to call once the animation is complete.
*/
fadeTo(duration: string, opacity: number, complete?: Function): JQuery;
/**
* Adjust the opacity of the matched elements.
*
* @param duration A string or number determining how long the animation will run.
* @param opacity A number between 0 and 1 denoting the target opacity.
* @param complete A function to call once the animation is complete.
*/
fadeTo(duration: number, opacity: number, complete?: Function): JQuery;
fadeTo(duration: string|number, opacity: number, complete?: Function): JQuery;
/**
* Adjust the opacity of the matched elements.
*
@@ -2023,16 +1893,7 @@ interface JQuery {
* @param easing A string indicating which easing function to use for the transition.
* @param complete A function to call once the animation is complete.
*/
fadeTo(duration: string, opacity: number, easing?: string, complete?: Function): JQuery;
/**
* Adjust the opacity of the matched elements.
*
* @param duration A string or number determining how long the animation will run.
* @param opacity A number between 0 and 1 denoting the target opacity.
* @param easing A string indicating which easing function to use for the transition.
* @param complete A function to call once the animation is complete.
*/
fadeTo(duration: number, opacity: number, easing?: string, complete?: Function): JQuery;
fadeTo(duration: string|number, opacity: number, easing?: string, complete?: Function): JQuery;
/**
* Display or hide the matched elements by animating their opacity.
@@ -2040,14 +1901,7 @@ interface JQuery {
* @param duration A string or number determining how long the animation will run.
* @param complete A function to call once the animation is complete.
*/
fadeToggle(duration?: number, complete?: Function): JQuery;
/**
* Display or hide the matched elements by animating their opacity.
*
* @param duration A string or number determining how long the animation will run.
* @param complete A function to call once the animation is complete.
*/
fadeToggle(duration?: string, complete?: Function): JQuery;
fadeToggle(duration?: number|string, complete?: Function): JQuery;
/**
* Display or hide the matched elements by animating their opacity.
*
@@ -2055,15 +1909,7 @@ interface JQuery {
* @param easing A string indicating which easing function to use for the transition.
* @param complete A function to call once the animation is complete.
*/
fadeToggle(duration?: number, easing?: string, complete?: Function): JQuery;
/**
* Display or hide the matched elements by animating their opacity.
*
* @param duration A string or number determining how long the animation will run.
* @param easing A string indicating which easing function to use for the transition.
* @param complete A function to call once the animation is complete.
*/
fadeToggle(duration?: string, easing?: string, complete?: Function): JQuery;
fadeToggle(duration?: number|string, easing?: string, complete?: Function): JQuery;
/**
* Display or hide the matched elements by animating their opacity.
*
@@ -2084,14 +1930,7 @@ interface JQuery {
* @param duration A string or number determining how long the animation will run.
* @param complete A function to call once the animation is complete.
*/
hide(duration?: number, complete?: Function): JQuery;
/**
* Hide the matched elements.
*
* @param duration A string or number determining how long the animation will run.
* @param complete A function to call once the animation is complete.
*/
hide(duration?: string, complete?: Function): JQuery;
hide(duration?: number|string, complete?: Function): JQuery;
/**
* Hide the matched elements.
*
@@ -2099,15 +1938,7 @@ interface JQuery {
* @param easing A string indicating which easing function to use for the transition.
* @param complete A function to call once the animation is complete.
*/
hide(duration?: number, easing?: string, complete?: Function): JQuery;
/**
* Hide the matched elements.
*
* @param duration A string or number determining how long the animation will run.
* @param easing A string indicating which easing function to use for the transition.
* @param complete A function to call once the animation is complete.
*/
hide(duration?: string, easing?: string, complete?: Function): JQuery;
hide(duration?: number|string, easing?: string, complete?: Function): JQuery;
/**
* Hide the matched elements.
*
@@ -2121,14 +1952,7 @@ interface JQuery {
* @param duration A string or number determining how long the animation will run.
* @param complete A function to call once the animation is complete.
*/
show(duration?: number, complete?: Function): JQuery;
/**
* Display the matched elements.
*
* @param duration A string or number determining how long the animation will run.
* @param complete A function to call once the animation is complete.
*/
show(duration?: string, complete?: Function): JQuery;
show(duration?: number|string, complete?: Function): JQuery;
/**
* Display the matched elements.
*
@@ -2136,15 +1960,7 @@ interface JQuery {
* @param easing A string indicating which easing function to use for the transition.
* @param complete A function to call once the animation is complete.
*/
show(duration?: number, easing?: string, complete?: Function): JQuery;
/**
* Display the matched elements.
*
* @param duration A string or number determining how long the animation will run.
* @param easing A string indicating which easing function to use for the transition.
* @param complete A function to call once the animation is complete.
*/
show(duration?: string, easing?: string, complete?: Function): JQuery;
show(duration?: number|string, easing?: string, complete?: Function): JQuery;
/**
* Display the matched elements.
*
@@ -2158,14 +1974,7 @@ interface JQuery {
* @param duration A string or number determining how long the animation will run.
* @param complete A function to call once the animation is complete.
*/
slideDown(duration?: number, complete?: Function): JQuery;
/**
* Display the matched elements with a sliding motion.
*
* @param duration A string or number determining how long the animation will run.
* @param complete A function to call once the animation is complete.
*/
slideDown(duration?: string, complete?: Function): JQuery;
slideDown(duration?: number|string, complete?: Function): JQuery;
/**
* Display the matched elements with a sliding motion.
*
@@ -2173,15 +1982,7 @@ interface JQuery {
* @param easing A string indicating which easing function to use for the transition.
* @param complete A function to call once the animation is complete.
*/
slideDown(duration?: number, easing?: string, complete?: Function): JQuery;
/**
* Display the matched elements with a sliding motion.
*
* @param duration A string or number determining how long the animation will run.
* @param easing A string indicating which easing function to use for the transition.
* @param complete A function to call once the animation is complete.
*/
slideDown(duration?: string, easing?: string, complete?: Function): JQuery;
slideDown(duration?: number|string, easing?: string, complete?: Function): JQuery;
/**
* Display the matched elements with a sliding motion.
*
@@ -2195,14 +1996,7 @@ interface JQuery {
* @param duration A string or number determining how long the animation will run.
* @param complete A function to call once the animation is complete.
*/
slideToggle(duration?: number, complete?: Function): JQuery;
/**
* Display or hide the matched elements with a sliding motion.
*
* @param duration A string or number determining how long the animation will run.
* @param complete A function to call once the animation is complete.
*/
slideToggle(duration?: string, complete?: Function): JQuery;
slideToggle(duration?: number|string, complete?: Function): JQuery;
/**
* Display or hide the matched elements with a sliding motion.
*
@@ -2210,15 +2004,7 @@ interface JQuery {
* @param easing A string indicating which easing function to use for the transition.
* @param complete A function to call once the animation is complete.
*/
slideToggle(duration?: number, easing?: string, complete?: Function): JQuery;
/**
* Display or hide the matched elements with a sliding motion.
*
* @param duration A string or number determining how long the animation will run.
* @param easing A string indicating which easing function to use for the transition.
* @param complete A function to call once the animation is complete.
*/
slideToggle(duration?: string, easing?: string, complete?: Function): JQuery;
slideToggle(duration?: number|string, easing?: string, complete?: Function): JQuery;
/**
* Display or hide the matched elements with a sliding motion.
*
@@ -2232,14 +2018,7 @@ interface JQuery {
* @param duration A string or number determining how long the animation will run.
* @param complete A function to call once the animation is complete.
*/
slideUp(duration?: number, complete?: Function): JQuery;
/**
* Hide the matched elements with a sliding motion.
*
* @param duration A string or number determining how long the animation will run.
* @param complete A function to call once the animation is complete.
*/
slideUp(duration?: string, complete?: Function): JQuery;
slideUp(duration?: number|string, complete?: Function): JQuery;
/**
* Hide the matched elements with a sliding motion.
*
@@ -2247,15 +2026,7 @@ interface JQuery {
* @param easing A string indicating which easing function to use for the transition.
* @param complete A function to call once the animation is complete.
*/
slideUp(duration?: number, easing?: string, complete?: Function): JQuery;
/**
* Hide the matched elements with a sliding motion.
*
* @param duration A string or number determining how long the animation will run.
* @param easing A string indicating which easing function to use for the transition.
* @param complete A function to call once the animation is complete.
*/
slideUp(duration?: string, easing?: string, complete?: Function): JQuery;
slideUp(duration?: number|string, easing?: string, complete?: Function): JQuery;
/**
* Hide the matched elements with a sliding motion.
*
@@ -2285,14 +2056,7 @@ interface JQuery {
* @param duration A string or number determining how long the animation will run.
* @param complete A function to call once the animation is complete.
*/
toggle(duration?: number, complete?: Function): JQuery;
/**
* Display or hide the matched elements.
*
* @param duration A string or number determining how long the animation will run.
* @param complete A function to call once the animation is complete.
*/
toggle(duration?: string, complete?: Function): JQuery;
toggle(duration?: number|string, complete?: Function): JQuery;
/**
* Display or hide the matched elements.
*
@@ -2300,15 +2064,7 @@ interface JQuery {
* @param easing A string indicating which easing function to use for the transition.
* @param complete A function to call once the animation is complete.
*/
toggle(duration?: number, easing?: string, complete?: Function): JQuery;
/**
* Display or hide the matched elements.
*
* @param duration A string or number determining how long the animation will run.
* @param easing A string indicating which easing function to use for the transition.
* @param complete A function to call once the animation is complete.
*/
toggle(duration?: string, easing?: string, complete?: Function): JQuery;
toggle(duration?: number|string, easing?: string, complete?: Function): JQuery;
/**
* Display or hide the matched elements.
*