diff --git a/types/jquery/jquery-tests.ts b/types/jquery/jquery-tests.ts index 84c1e66841..c569758fb0 100644 --- a/types/jquery/jquery-tests.ts +++ b/types/jquery/jquery-tests.ts @@ -17,6 +17,9 @@ function JQueryStatic() { } }); + // $ExpectType JQuery + $('

'); + // $ExpectType JQuery $('span', new HTMLElement()); @@ -29,20 +32,20 @@ function JQueryStatic() { // $ExpectType JQuery $('span'); - // $ExpectType JQuery - $('

'); + // $ExpectType JQuery + $('.mysvgline'); - // $ExpectType JQuery - $(new HTMLElement()); + // $ExpectType JQuery + $(new HTMLParagraphElement()); - // $ExpectType JQuery - $([new HTMLElement()]); + // $ExpectType JQuery + $([new HTMLParagraphElement()]); // $ExpectType JQuery<{ foo: string; hello: string; }> $({ foo: 'bar', hello: 'world' }); - // $ExpectType JQuery - $($('p')); + // $ExpectType JQuery + $($(document.createElementNS("http://www.w3.org/2000/svg", "svg"))); // $ExpectType JQuery $(function($) { @@ -52,9 +55,20 @@ function JQueryStatic() { $; }); + // $ExpectType JQuery + $(function($) { + // $ExpectType Document + this; + // $ExpectType JQueryStatic + $; + }); + // $ExpectType JQuery $(); + // $ExpectType JQuery + $(); + // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/19597#issuecomment-378218432 function issue_19597_378218432() { const myDiv = $(document.createElement('div'));