From fd08ade477b6ddff02e963ad5766a3bb186e7737 Mon Sep 17 00:00:00 2001 From: Diogo Franco Date: Wed, 21 Jun 2017 18:02:03 +0900 Subject: [PATCH 1/2] jquery: Make JQueryStatic's context optional Not having this prevents calling JQueryStatic with a potentially-`undefined` second argument. --- types/jquery/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/jquery/index.d.ts b/types/jquery/index.d.ts index cea056ef60..7f516a1a7c 100644 --- a/types/jquery/index.d.ts +++ b/types/jquery/index.d.ts @@ -2446,7 +2446,7 @@ interface JQueryStatic { * @see {@link https://api.jquery.com/jQuery/} * @since 1.0 */ - (selector: JQuery.Selector, context: Element | Document | JQuery): JQuery; + (selector: JQuery.Selector, context?: Element | Document | JQuery): JQuery; /** * Creates DOM elements on the fly from the provided string of raw HTML. * From 5f557253c000fc81fb0d8b2697d13a9c421a78dc Mon Sep 17 00:00:00 2001 From: Diogo Franco Date: Thu, 22 Jun 2017 10:44:37 +0900 Subject: [PATCH 2/2] jquery: Make context non-optional, but allow undefined Ensures the correct overload is used when the second parameter is not provided. --- types/jquery/index.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/types/jquery/index.d.ts b/types/jquery/index.d.ts index c12e7051b8..2c7d5ce75a 100644 --- a/types/jquery/index.d.ts +++ b/types/jquery/index.d.ts @@ -2470,11 +2470,10 @@ interface JQueryStatic { * @see {@link https://api.jquery.com/jQuery/} * @since 1.0 */ - (selector: JQuery.Selector, context?: Element | Document | JQuery): JQuery; + (selector: JQuery.Selector, context: Element | Document | JQuery | undefined): JQuery; // HACK: This is the factory function returned when importing jQuery without a DOM. Declaring it separately breaks using the type parameter on JQueryStatic. // HACK: The discriminator parameter handles the edge case of passing a Window object to JQueryStatic. It doesn't actually exist on the factory function. (window: Window, discriminator: boolean): JQueryStatic; - /** * Creates DOM elements on the fly from the provided string of raw HTML. *