From c28effe556e1dc93900a988d524a29f38de78118 Mon Sep 17 00:00:00 2001 From: Leo Rudberg Date: Wed, 7 Sep 2016 16:42:48 -0500 Subject: [PATCH 1/3] Changed return type of `toArray` to `Element[]` Also changed the return type for `get(void)` and added a JSDoc `@alias` annotation. --- jquery/jquery.d.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index 0f72c709cf..043ca70124 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -2780,8 +2780,9 @@ interface JQuery { /** * Retrieve all the elements contained in the jQuery set, as an array. + * @name toArray */ - toArray(): any[]; + toArray(): Element[]; /** * Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place. @@ -2837,8 +2838,9 @@ interface JQuery { get(index: number): HTMLElement; /** * Retrieve the elements matched by the jQuery object. + * @alias toArray */ - get(): any[]; + get(): Element[]; /** * Search for a given element from among the matched elements. From 29138f09854b66126f8252559e681393987c8e81 Mon Sep 17 00:00:00 2001 From: Leo Rudberg Date: Thu, 8 Sep 2016 15:04:15 -0500 Subject: [PATCH 2/3] Support Element or HTMLElement return type This should fix the failure reported here: https://travis-ci.org/DefinitelyTyped/DefinitelyTyped/builds/158300393#L1213 --- jquery/jquery.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index 043ca70124..4fdbedcfd5 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -2782,7 +2782,7 @@ interface JQuery { * Retrieve all the elements contained in the jQuery set, as an array. * @name toArray */ - toArray(): Element[]; + toArray(): (Element|HTMLElement)[]; /** * Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place. @@ -2840,7 +2840,7 @@ interface JQuery { * Retrieve the elements matched by the jQuery object. * @alias toArray */ - get(): Element[]; + get(): (Element|HTMLElement)[]; /** * Search for a given element from among the matched elements. From 5c7d1fcbea9b14df54fc4554d94cb67dfabffd9a Mon Sep 17 00:00:00 2001 From: Leo Rudberg Date: Thu, 8 Sep 2016 15:32:39 -0500 Subject: [PATCH 3/3] Removed Element return type Now the __only__ return type is `HTMLElement`, which should solve the Travis build/test failure. --- jquery/jquery.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index 4fdbedcfd5..b08598cc53 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -2782,7 +2782,7 @@ interface JQuery { * Retrieve all the elements contained in the jQuery set, as an array. * @name toArray */ - toArray(): (Element|HTMLElement)[]; + toArray(): HTMLElement[]; /** * Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place. @@ -2840,7 +2840,7 @@ interface JQuery { * Retrieve the elements matched by the jQuery object. * @alias toArray */ - get(): (Element|HTMLElement)[]; + get(): HTMLElement[]; /** * Search for a given element from among the matched elements.