diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2019-10-04 08:20:12 +1000 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-10-03 18:20:12 -0400 |
commit | 403bdfc3ec258a0dd3a5d03391d3dc32648f2bbe (patch) | |
tree | b44faa9ee55e5ac4b2fd0d3717cc3f84a51d7213 /js | |
parent | d9acc5b17e8bc465ec88f922876eecab5a72047c (diff) |
Fix iterators on UrlSearchParams (#3044)
Diffstat (limited to 'js')
-rw-r--r-- | js/dom_types.ts | 4 | ||||
-rw-r--r-- | js/lib.deno_runtime.d.ts | 14 | ||||
-rw-r--r-- | js/url_search_params.ts | 10 |
3 files changed, 14 insertions, 14 deletions
diff --git a/js/dom_types.ts b/js/dom_types.ts index a7c36df32..308505cf5 100644 --- a/js/dom_types.ts +++ b/js/dom_types.ts @@ -100,7 +100,7 @@ export interface ProgressEventInit extends EventInit { total?: number; } -export interface URLSearchParams { +export interface URLSearchParams extends DomIterable<string, string> { /** * Appends a specified key/value pair as a new search parameter. */ @@ -142,7 +142,7 @@ export interface URLSearchParams { * and invokes the given function. */ forEach( - callbackfn: (value: string, key: string, parent: URLSearchParams) => void, + callbackfn: (value: string, key: string, parent: this) => void, thisArg?: any ): void; } diff --git a/js/lib.deno_runtime.d.ts b/js/lib.deno_runtime.d.ts index 780503106..94b6b61cd 100644 --- a/js/lib.deno_runtime.d.ts +++ b/js/lib.deno_runtime.d.ts @@ -1459,7 +1459,7 @@ declare namespace domTypes { loaded?: number; total?: number; } - export interface URLSearchParams { + export interface URLSearchParams extends DomIterable<string, string> { /** * Appends a specified key/value pair as a new search parameter. */ @@ -1501,7 +1501,7 @@ declare namespace domTypes { * and invokes the given function. */ forEach( - callbackfn: (value: string, key: string, parent: URLSearchParams) => void, + callbackfn: (value: string, key: string, parent: this) => void, thisArg?: any ): void; } @@ -2495,7 +2495,7 @@ declare namespace urlSearchParams { * */ forEach( - callbackfn: (value: string, key: string, parent: URLSearchParams) => void, + callbackfn: (value: string, key: string, parent: this) => void, thisArg?: any ): void; /** Returns an iterator allowing to go through all keys contained @@ -2505,7 +2505,7 @@ declare namespace urlSearchParams { * console.log(key); * } */ - keys(): Iterable<string>; + keys(): IterableIterator<string>; /** Returns an iterator allowing to go through all values contained * in this object. * @@ -2513,7 +2513,7 @@ declare namespace urlSearchParams { * console.log(value); * } */ - values(): Iterable<string>; + values(): IterableIterator<string>; /** Returns an iterator allowing to go through all key/value * pairs contained in this object. * @@ -2521,7 +2521,7 @@ declare namespace urlSearchParams { * console.log(key, value); * } */ - entries(): Iterable<[string, string]>; + entries(): IterableIterator<[string, string]>; /** Returns an iterator allowing to go through all key/value * pairs contained in this object. * @@ -2529,7 +2529,7 @@ declare namespace urlSearchParams { * console.log(key, value); * } */ - [Symbol.iterator](): Iterable<[string, string]>; + [Symbol.iterator](): IterableIterator<[string, string]>; /** Returns a query string suitable for use in a URL. * * searchParams.toString(); diff --git a/js/url_search_params.ts b/js/url_search_params.ts index 63c02d3b8..0835133d5 100644 --- a/js/url_search_params.ts +++ b/js/url_search_params.ts @@ -184,7 +184,7 @@ export class URLSearchParams { * */ forEach( - callbackfn: (value: string, key: string, parent: URLSearchParams) => void, + callbackfn: (value: string, key: string, parent: this) => void, // eslint-disable-next-line @typescript-eslint/no-explicit-any thisArg?: any ): void { @@ -206,7 +206,7 @@ export class URLSearchParams { * console.log(key); * } */ - *keys(): Iterable<string> { + *keys(): IterableIterator<string> { for (const entry of this.params) { yield entry[0]; } @@ -219,7 +219,7 @@ export class URLSearchParams { * console.log(value); * } */ - *values(): Iterable<string> { + *values(): IterableIterator<string> { for (const entry of this.params) { yield entry[1]; } @@ -232,7 +232,7 @@ export class URLSearchParams { * console.log(key, value); * } */ - *entries(): Iterable<[string, string]> { + *entries(): IterableIterator<[string, string]> { yield* this.params; } @@ -243,7 +243,7 @@ export class URLSearchParams { * console.log(key, value); * } */ - *[Symbol.iterator](): Iterable<[string, string]> { + *[Symbol.iterator](): IterableIterator<[string, string]> { yield* this.params; } |