[jquery] Add self-extending overloads of jQuery.extend(). (#29924)

This commit is contained in:
Leonard Thieu
2018-10-22 09:25:28 -07:00
committed by Sheetal Nandi
parent daa2f21886
commit 59b32e5353
2 changed files with 22 additions and 0 deletions
+16
View File
@@ -940,6 +940,14 @@ $( "#log" ).append( JSON.stringify( object1 ) );
```
*/
extend<T, U>(deep: true, target: T, object1: U): T & U;
/**
* Merge the contents of two or more objects together into the first object.
* @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported.
* @param target The object to extend. It will receive the new properties.
* @see \`{@link https://api.jquery.com/jQuery.extend/ }\`
* @since 1.1.4
*/
extend<T>(deep: true, target: T): this & T;
/**
* Merge the contents of two or more objects together into the first object.
* @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported.
@@ -1431,6 +1439,14 @@ $( "#log" ).append( "<div><b>settings -- </b>" + JSON.stringify( settings ) + "<
```
*/
extend<T, U>(target: T, object1: U): T & U;
/**
* Merge the contents of two or more objects together into the first object.
* @param target An object that will receive the new properties if additional objects are passed in or that will
* extend the jQuery namespace if it is the sole argument.
* @see \`{@link https://api.jquery.com/jQuery.extend/ }\`
* @since 1.0
*/
extend<T>(target: T): this & T;
/**
* Merge the contents of two or more objects together into the first object.
* @param target An object that will receive the new properties if additional objects are passed in or that will
+6
View File
@@ -463,6 +463,9 @@ function JQueryStatic() {
// $ExpectType { name: string; } & EventTarget
$.extend(true, t, u);
// $ExpectType JQueryStatic & { name: string; }
$.extend(true, t);
// $ExpectType any
$.extend(true, t, u, v, w, x, y, z, a);
@@ -484,6 +487,9 @@ function JQueryStatic() {
// $ExpectType { name: string; } & EventTarget
$.extend(t, u);
// $ExpectType JQueryStatic & { name: string; }
$.extend(t);
// $ExpectType any
$.extend(t, u, v, w, x, y, z, a);
}