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

update typings to indicate Seq() faux-iterator support #1886

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
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
13 changes: 12 additions & 1 deletion type-definitions/immutable.d.ts
Expand Up @@ -3124,6 +3124,13 @@ declare namespace Immutable {
}
}

/**
* For pre-ES2015 support where `Symbol.iterator` does not exist.
*/
interface FauxIterable<T> {
['@@iterator'](): Iterator<T>;
}

/**
* Creates a Seq.
*
Expand All @@ -3147,7 +3154,11 @@ declare namespace Immutable {
function Seq<K, V>(collection: Collection.Keyed<K, V>): Seq.Keyed<K, V>;
function Seq<T>(collection: Collection.Set<T>): Seq.Set<T>;
function Seq<T>(
collection: Collection.Indexed<T> | Iterable<T> | ArrayLike<T>
collection:
| Collection.Indexed<T>
| Iterable<T>
| FauxIterable<T>
| ArrayLike<T>
): Seq.Indexed<T>;
function Seq<V>(obj: { [key: string]: V }): Seq.Keyed<string, V>;
function Seq<K = unknown, V = unknown>(): Seq<K, V>;
Expand Down