jquery: Make context non-optional, but allow undefined

Ensures the correct overload is used when the second parameter is not provided.
This commit is contained in:
Diogo Franco
2017-06-22 10:44:37 +09:00
committed by GitHub
parent 066431b771
commit 5f557253c0

View File

@@ -2470,11 +2470,10 @@ interface JQueryStatic<TElement extends Node = HTMLElement> {
* @see {@link https://api.jquery.com/jQuery/}
* @since 1.0
*/
(selector: JQuery.Selector, context?: Element | Document | JQuery): JQuery<TElement>;
(selector: JQuery.Selector, context: Element | Document | JQuery | undefined): JQuery<TElement>;
// 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.
<FElement extends Node = HTMLElement>(window: Window, discriminator: boolean): JQueryStatic<FElement>;
/**
* Creates DOM elements on the fly from the provided string of raw HTML.
*