diff --git a/types/jquery/index.d.ts b/types/jquery/index.d.ts index 4bf8e03ee7..821e7ec162 100644 --- a/types/jquery/index.d.ts +++ b/types/jquery/index.d.ts @@ -4327,7 +4327,7 @@ interface JQuery extends Iterable { * @see \`{@link https://api.jquery.com/insertAfter/ }\` * @since 1.0 */ - insertAfter(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray | JQuery): this; + insertAfter(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray | JQuery): this; /** * Insert every element in the set of matched elements before the target. * @@ -4336,7 +4336,7 @@ interface JQuery extends Iterable { * @see \`{@link https://api.jquery.com/insertBefore/ }\` * @since 1.0 */ - insertBefore(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray | JQuery): this; + insertBefore(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray | JQuery): this; /** * Check the current matched set of elements against a selector, element, or jQuery object and return * true if at least one of these elements matches the given arguments. diff --git a/types/jquery/jquery-tests.ts b/types/jquery/jquery-tests.ts index bee2c7c2ab..309b1e2f89 100644 --- a/types/jquery/jquery-tests.ts +++ b/types/jquery/jquery-tests.ts @@ -5681,6 +5681,12 @@ function JQuery() { // $ExpectType JQuery $('span').insertAfter($('p')); + + // $ExpectType JQuery + $('span').insertAfter(new Text('hello!')); + + // $ExpectType JQuery + $('span').insertAfter($(new Text('hello!'))); } function insertBefore() { @@ -5698,6 +5704,12 @@ function JQuery() { // $ExpectType JQuery $('span').insertBefore($('p')); + + // $ExpectType JQuery + $('span').insertBefore(new Text('hello!')); + + // $ExpectType JQuery + $('span').insertBefore($(new Text('hello!'))); } function prependTo() {