mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-03 06:27:46 +08:00
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:
3
types/jquery/index.d.ts
vendored
3
types/jquery/index.d.ts
vendored
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user