From 9c8efe5fd0224aa3284fee4646f2664e7676eb3d Mon Sep 17 00:00:00 2001 From: stalbert Date: Mon, 25 Oct 2021 13:31:40 -0700 Subject: [PATCH] update typings to indicate that `Seq()` also allows an object with a property named `@@iterator` (e.g. for environments pre-ES2015 where `Symbol.iterator` does not natively exist). Related discussion on pull request #1589 --- type-definitions/immutable.d.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/type-definitions/immutable.d.ts b/type-definitions/immutable.d.ts index 636528036..30a491ed2 100644 --- a/type-definitions/immutable.d.ts +++ b/type-definitions/immutable.d.ts @@ -3124,6 +3124,13 @@ declare namespace Immutable { } } + /** + * For pre-ES2015 support where `Symbol.iterator` does not exist. + */ + interface FauxIterable { + ['@@iterator'](): Iterator; + } + /** * Creates a Seq. * @@ -3147,7 +3154,11 @@ declare namespace Immutable { function Seq(collection: Collection.Keyed): Seq.Keyed; function Seq(collection: Collection.Set): Seq.Set; function Seq( - collection: Collection.Indexed | Iterable | ArrayLike + collection: + | Collection.Indexed + | Iterable + | FauxIterable + | ArrayLike ): Seq.Indexed; function Seq(obj: { [key: string]: V }): Seq.Keyed; function Seq(): Seq;