From c6ba2a627643107bb092c96eb44f71048eeb1cec Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Mon, 26 Jun 2017 11:42:19 -0400 Subject: [PATCH] [jquery] Allow writing through index signature on JQuery. --- types/jquery/index.d.ts | 4 +++- types/jquery/jquery-tests.ts | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/types/jquery/index.d.ts b/types/jquery/index.d.ts index d13ed8af42..8d688d1b20 100644 --- a/types/jquery/index.d.ts +++ b/types/jquery/index.d.ts @@ -2390,9 +2390,11 @@ interface JQuery { * @since 1.4 */ wrapInner(wrappingElement: JQuery.Selector | JQuery.htmlString | Element | JQuery | ((this: TElement, index: number) => string | JQuery | Element)): this; + + [n: number]: TElement; } -interface JQuery extends ArrayLike, Iterable { } +interface JQuery extends Iterable { } interface JQueryStatic { /** diff --git a/types/jquery/jquery-tests.ts b/types/jquery/jquery-tests.ts index 609f65c6f1..cacd81bcff 100644 --- a/types/jquery/jquery-tests.ts +++ b/types/jquery/jquery-tests.ts @@ -11,7 +11,10 @@ function JQuery() { } function arrayLike() { - $('div')[0] === new HTMLElement(); + // $ExpectType HTMLElement + $('div')[0]; + + $('div')[0] = new HTMLElement(); } function ajax() {