0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-04 01:44:26 -05:00

Fix iterators on UrlSearchParams (#3044)

This commit is contained in:
Kitson Kelly 2019-10-04 08:20:12 +10:00 committed by Ryan Dahl
parent d9acc5b17e
commit 403bdfc3ec
3 changed files with 14 additions and 14 deletions

View file

@ -100,7 +100,7 @@ export interface ProgressEventInit extends EventInit {
total?: number; total?: number;
} }
export interface URLSearchParams { export interface URLSearchParams extends DomIterable<string, string> {
/** /**
* Appends a specified key/value pair as a new search parameter. * Appends a specified key/value pair as a new search parameter.
*/ */
@ -142,7 +142,7 @@ export interface URLSearchParams {
* and invokes the given function. * and invokes the given function.
*/ */
forEach( forEach(
callbackfn: (value: string, key: string, parent: URLSearchParams) => void, callbackfn: (value: string, key: string, parent: this) => void,
thisArg?: any thisArg?: any
): void; ): void;
} }

View file

@ -1459,7 +1459,7 @@ declare namespace domTypes {
loaded?: number; loaded?: number;
total?: number; total?: number;
} }
export interface URLSearchParams { export interface URLSearchParams extends DomIterable<string, string> {
/** /**
* Appends a specified key/value pair as a new search parameter. * Appends a specified key/value pair as a new search parameter.
*/ */
@ -1501,7 +1501,7 @@ declare namespace domTypes {
* and invokes the given function. * and invokes the given function.
*/ */
forEach( forEach(
callbackfn: (value: string, key: string, parent: URLSearchParams) => void, callbackfn: (value: string, key: string, parent: this) => void,
thisArg?: any thisArg?: any
): void; ): void;
} }
@ -2495,7 +2495,7 @@ declare namespace urlSearchParams {
* *
*/ */
forEach( forEach(
callbackfn: (value: string, key: string, parent: URLSearchParams) => void, callbackfn: (value: string, key: string, parent: this) => void,
thisArg?: any thisArg?: any
): void; ): void;
/** Returns an iterator allowing to go through all keys contained /** Returns an iterator allowing to go through all keys contained
@ -2505,7 +2505,7 @@ declare namespace urlSearchParams {
* console.log(key); * console.log(key);
* } * }
*/ */
keys(): Iterable<string>; keys(): IterableIterator<string>;
/** Returns an iterator allowing to go through all values contained /** Returns an iterator allowing to go through all values contained
* in this object. * in this object.
* *
@ -2513,7 +2513,7 @@ declare namespace urlSearchParams {
* console.log(value); * console.log(value);
* } * }
*/ */
values(): Iterable<string>; values(): IterableIterator<string>;
/** Returns an iterator allowing to go through all key/value /** Returns an iterator allowing to go through all key/value
* pairs contained in this object. * pairs contained in this object.
* *
@ -2521,7 +2521,7 @@ declare namespace urlSearchParams {
* console.log(key, value); * console.log(key, value);
* } * }
*/ */
entries(): Iterable<[string, string]>; entries(): IterableIterator<[string, string]>;
/** Returns an iterator allowing to go through all key/value /** Returns an iterator allowing to go through all key/value
* pairs contained in this object. * pairs contained in this object.
* *
@ -2529,7 +2529,7 @@ declare namespace urlSearchParams {
* console.log(key, value); * console.log(key, value);
* } * }
*/ */
[Symbol.iterator](): Iterable<[string, string]>; [Symbol.iterator](): IterableIterator<[string, string]>;
/** Returns a query string suitable for use in a URL. /** Returns a query string suitable for use in a URL.
* *
* searchParams.toString(); * searchParams.toString();

View file

@ -184,7 +184,7 @@ export class URLSearchParams {
* *
*/ */
forEach( 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 // eslint-disable-next-line @typescript-eslint/no-explicit-any
thisArg?: any thisArg?: any
): void { ): void {
@ -206,7 +206,7 @@ export class URLSearchParams {
* console.log(key); * console.log(key);
* } * }
*/ */
*keys(): Iterable<string> { *keys(): IterableIterator<string> {
for (const entry of this.params) { for (const entry of this.params) {
yield entry[0]; yield entry[0];
} }
@ -219,7 +219,7 @@ export class URLSearchParams {
* console.log(value); * console.log(value);
* } * }
*/ */
*values(): Iterable<string> { *values(): IterableIterator<string> {
for (const entry of this.params) { for (const entry of this.params) {
yield entry[1]; yield entry[1];
} }
@ -232,7 +232,7 @@ export class URLSearchParams {
* console.log(key, value); * console.log(key, value);
* } * }
*/ */
*entries(): Iterable<[string, string]> { *entries(): IterableIterator<[string, string]> {
yield* this.params; yield* this.params;
} }
@ -243,7 +243,7 @@ export class URLSearchParams {
* console.log(key, value); * console.log(key, value);
* } * }
*/ */
*[Symbol.iterator](): Iterable<[string, string]> { *[Symbol.iterator](): IterableIterator<[string, string]> {
yield* this.params; yield* this.params;
} }