[jquery] after(), append(), before(), and prepend() should accept JQuery<JQuery.Node>.

This commit is contained in:
Leonard Thieu
2017-08-04 10:52:39 -04:00
parent c9bd9cf538
commit 28022c0fe8
2 changed files with 16 additions and 16 deletions
+8 -8
View File
@@ -3017,7 +3017,7 @@ interface JQuery<TElement extends Node = HTMLElement> extends Iterable<TElement>
* @see {@link https://api.jquery.com/after/}
* @since 1.0
*/
after(...contents: Array<JQuery.htmlString | JQuery.TypeOrArray<JQuery.Node> | JQuery>): this;
after(...contents: Array<JQuery.htmlString | JQuery.TypeOrArray<JQuery.Node> | JQuery<JQuery.Node>>): this;
/**
* Insert content, specified by the parameter, after each element in the set of matched elements.
*
@@ -3029,7 +3029,7 @@ interface JQuery<TElement extends Node = HTMLElement> extends Iterable<TElement>
* @since 1.4
* @since 1.10
*/
after(fn: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray<JQuery.Node> | JQuery): this;
after(fn: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray<JQuery.Node> | JQuery<JQuery.Node>): this;
/**
* Register a handler to be called when Ajax requests complete. This is an AjaxEvent.
*
@@ -3133,7 +3133,7 @@ interface JQuery<TElement extends Node = HTMLElement> extends Iterable<TElement>
* @see {@link https://api.jquery.com/append/}
* @since 1.0
*/
append(...contents: Array<JQuery.htmlString | JQuery.TypeOrArray<JQuery.Node> | JQuery>): this;
append(...contents: Array<JQuery.htmlString | JQuery.TypeOrArray<JQuery.Node> | JQuery<JQuery.Node>>): this;
/**
* Insert content, specified by the parameter, to the end of each element in the set of matched elements.
*
@@ -3144,7 +3144,7 @@ interface JQuery<TElement extends Node = HTMLElement> extends Iterable<TElement>
* @see {@link https://api.jquery.com/append/}
* @since 1.4
*/
append(fn: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray<JQuery.Node> | JQuery): this;
append(fn: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray<JQuery.Node> | JQuery<JQuery.Node>): this;
/**
* Insert every element in the set of matched elements to the end of the target.
*
@@ -3191,7 +3191,7 @@ interface JQuery<TElement extends Node = HTMLElement> extends Iterable<TElement>
* @see {@link https://api.jquery.com/before/}
* @since 1.0
*/
before(...contents: Array<JQuery.htmlString | JQuery.TypeOrArray<JQuery.Node> | JQuery>): this;
before(...contents: Array<JQuery.htmlString | JQuery.TypeOrArray<JQuery.Node> | JQuery<JQuery.Node>>): this;
/**
* Insert content, specified by the parameter, before each element in the set of matched elements.
*
@@ -3203,7 +3203,7 @@ interface JQuery<TElement extends Node = HTMLElement> extends Iterable<TElement>
* @since 1.4
* @since 1.10
*/
before(fn: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray<JQuery.Node> | JQuery): this;
before(fn: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray<JQuery.Node> | JQuery<JQuery.Node>): this;
// [bind() overloads] https://github.com/jquery/api.jquery.com/issues/1048
/**
* Attach a handler to an event for the elements.
@@ -4595,7 +4595,7 @@ interface JQuery<TElement extends Node = HTMLElement> extends Iterable<TElement>
* @see {@link https://api.jquery.com/prepend/}
* @since 1.0
*/
prepend(...contents: Array<JQuery.htmlString | JQuery.TypeOrArray<JQuery.Node> | JQuery>): this;
prepend(...contents: Array<JQuery.htmlString | JQuery.TypeOrArray<JQuery.Node> | JQuery<JQuery.Node>>): this;
/**
* Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.
*
@@ -4606,7 +4606,7 @@ interface JQuery<TElement extends Node = HTMLElement> extends Iterable<TElement>
* @see {@link https://api.jquery.com/prepend/}
* @since 1.4
*/
prepend(fn: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray<JQuery.Node> | JQuery): this;
prepend(fn: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray<JQuery.Node> | JQuery<JQuery.Node>): this;
/**
* Insert every element in the set of matched elements to the beginning of the target.
*
+8 -8
View File
@@ -5130,7 +5130,7 @@ function JQuery() {
function manipulation() {
function after() {
// $ExpectType JQuery<HTMLElement>
$('p').after('<p></p>', new Element(), new Text(), $('p'), [new Element(), new Text()]);
$('p').after('<p></p>', new Element(), new Text(), $('p').contents(), [new Element(), new Text()]);
// $ExpectType JQuery<HTMLElement>
$('p').after(function(index, html) {
@@ -5189,13 +5189,13 @@ function JQuery() {
// $ExpectType string
html;
return $('p');
return $('p').contents();
});
}
function append() {
// $ExpectType JQuery<HTMLElement>
$('p').append('<p></p>', new Element(), new Text(), $('p'), [new Element(), new Text()]);
$('p').append('<p></p>', new Element(), new Text(), $('p').contents(), [new Element(), new Text()]);
// $ExpectType JQuery<HTMLElement>
$('p').append(function(index, html) {
@@ -5254,7 +5254,7 @@ function JQuery() {
// $ExpectType string
html;
return $('p');
return $('p').contents();
});
// $ExpectType JQuery<HTMLElement>
@@ -5263,7 +5263,7 @@ function JQuery() {
function before() {
// $ExpectType JQuery<HTMLElement>
$('p').before('<p></p>', new Element(), new Text(), $('p'), [new Element(), new Text()]);
$('p').before('<p></p>', new Element(), new Text(), $('p').contents(), [new Element(), new Text()]);
// $ExpectType JQuery<HTMLElement>
$('p').before(function(index, html) {
@@ -5322,13 +5322,13 @@ function JQuery() {
// $ExpectType string
html;
return $('p');
return $('p').contents();
});
}
function prepend() {
// $ExpectType JQuery<HTMLElement>
$('p').prepend('<p></p>', new Element(), new Text(), $('p'), [new Element(), new Text()]);
$('p').prepend('<p></p>', new Element(), new Text(), $('p').contents(), [new Element(), new Text()]);
// $ExpectType JQuery<HTMLElement>
$('p').prepend(function(index, html) {
@@ -5387,7 +5387,7 @@ function JQuery() {
// $ExpectType string
html;
return $('p');
return $('p').contents();
});
}