Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TReturn/TNext to Iterable et al #58243

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
133 changes: 64 additions & 69 deletions src/compiler/checker.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/compiler/types.ts
Expand Up @@ -5199,7 +5199,7 @@ export interface TypeChecker {
/** @internal */ createPromiseType(type: Type): Type;
/** @internal */ getPromiseType(): Type;
/** @internal */ getPromiseLikeType(): Type;
/** @internal */ getAsyncIterableType(): Type | undefined;
/** @internal */ getAnyAsyncIterableType(): Type | undefined;

/**
* Returns true if the "source" type is assignable to the "target" type.
Expand Down
46 changes: 23 additions & 23 deletions src/lib/dom.iterable.d.ts
@@ -1,30 +1,30 @@
/// <reference lib="dom" />

interface DOMTokenList {
[Symbol.iterator](): IterableIterator<string>;
[Symbol.iterator](): IterableIterator<string, BuiltinIteratorReturn>;
}

interface Headers {
[Symbol.iterator](): IterableIterator<[string, string]>;
[Symbol.iterator](): IterableIterator<[string, string], BuiltinIteratorReturn>;
/**
* Returns an iterator allowing to go through all key/value pairs contained in this object.
*/
entries(): IterableIterator<[string, string]>;
entries(): IterableIterator<[string, string], BuiltinIteratorReturn>;
/**
* Returns an iterator allowing to go through all keys f the key/value pairs contained in this object.
*/
keys(): IterableIterator<string>;
keys(): IterableIterator<string, BuiltinIteratorReturn>;
/**
* Returns an iterator allowing to go through all values of the key/value pairs contained in this object.
*/
values(): IterableIterator<string>;
values(): IterableIterator<string, BuiltinIteratorReturn>;
}

interface NodeList {
/**
* Returns an array of key, value pairs for every entry in the list
*/
entries(): IterableIterator<[number, Node]>;
entries(): IterableIterator<[number, Node], BuiltinIteratorReturn>;
/**
* Performs the specified action for each node in an list.
* @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the list.
Expand All @@ -34,21 +34,21 @@ interface NodeList {
/**
* Returns an list of keys in the list
*/
keys(): IterableIterator<number>;
keys(): IterableIterator<number, BuiltinIteratorReturn>;

/**
* Returns an list of values in the list
*/
values(): IterableIterator<Node>;
values(): IterableIterator<Node, BuiltinIteratorReturn>;

[Symbol.iterator](): IterableIterator<Node>;
[Symbol.iterator](): IterableIterator<Node, BuiltinIteratorReturn>;
}

interface NodeListOf<TNode extends Node> {
/**
* Returns an array of key, value pairs for every entry in the list
*/
entries(): IterableIterator<[number, TNode]>;
entries(): IterableIterator<[number, TNode], BuiltinIteratorReturn>;

/**
* Performs the specified action for each node in an list.
Expand All @@ -59,55 +59,55 @@ interface NodeListOf<TNode extends Node> {
/**
* Returns an list of keys in the list
*/
keys(): IterableIterator<number>;
keys(): IterableIterator<number, BuiltinIteratorReturn>;
/**
* Returns an list of values in the list
*/
values(): IterableIterator<TNode>;
values(): IterableIterator<TNode, BuiltinIteratorReturn>;

[Symbol.iterator](): IterableIterator<TNode>;
[Symbol.iterator](): IterableIterator<TNode, BuiltinIteratorReturn>;
}

interface HTMLCollectionBase {
[Symbol.iterator](): IterableIterator<Element>;
[Symbol.iterator](): IterableIterator<Element, BuiltinIteratorReturn>;
}

interface HTMLCollectionOf<T extends Element> {
[Symbol.iterator](): IterableIterator<T>;
[Symbol.iterator](): IterableIterator<T, BuiltinIteratorReturn>;
}

interface FormData {
/**
* Returns an array of key, value pairs for every entry in the list
*/
entries(): IterableIterator<[string, string | File]>;
entries(): IterableIterator<[string, string | File], BuiltinIteratorReturn>;
/**
* Returns a list of keys in the list
*/
keys(): IterableIterator<string>;
keys(): IterableIterator<string, BuiltinIteratorReturn>;
/**
* Returns a list of values in the list
*/
values(): IterableIterator<string | File>;
values(): IterableIterator<string | File, BuiltinIteratorReturn>;

[Symbol.iterator](): IterableIterator<string | File>;
[Symbol.iterator](): IterableIterator<string | File, BuiltinIteratorReturn>;
}

interface URLSearchParams {
/**
* Returns an array of key, value pairs for every entry in the search params
*/
entries(): IterableIterator<[string, string]>;
entries(): IterableIterator<[string, string], BuiltinIteratorReturn>;
/**
* Returns a list of keys in the search params
*/
keys(): IterableIterator<string>;
keys(): IterableIterator<string, BuiltinIteratorReturn>;
/**
* Returns a list of values in the search params
*/
values(): IterableIterator<string>;
values(): IterableIterator<string, BuiltinIteratorReturn>;
/**
* iterate over key/value pairs
*/
[Symbol.iterator](): IterableIterator<[string, string]>;
[Symbol.iterator](): IterableIterator<[string, string], BuiltinIteratorReturn>;
}