diff --git a/.changeset/packages/mobx/.changeset/odd-years-shop.md b/.changeset/packages/mobx/.changeset/odd-years-shop.md new file mode 100644 index 000000000..d553f84da --- /dev/null +++ b/.changeset/packages/mobx/.changeset/odd-years-shop.md @@ -0,0 +1,5 @@ +--- +"mobx": patch +--- + +Fix typescript backwards compatability for versions pre 5.6 diff --git a/packages/mobx/src/lib.2015.iterable.backfill-pre-5.6.d.ts b/packages/mobx/src/lib.2015.iterable.backfill-pre-5.6.d.ts new file mode 100644 index 000000000..769e7624d --- /dev/null +++ b/packages/mobx/src/lib.2015.iterable.backfill-pre-5.6.d.ts @@ -0,0 +1,29 @@ +// for backward compatability with typescript pre version 5.6 +// copied from https://github.com/microsoft/TypeScript/blob/main/src/lib/es2015.iterable.d.ts + +/** + * Defines the `TReturn` type used for built-in iterators produced by `Array`, `Map`, `Set`, and others. + * This is `undefined` when `strictBuiltInIteratorReturn` is `true`; otherwise, this is `any`. + */ +type BuiltinIteratorReturn = intrinsic; + + +interface SetIterator extends IteratorObject { + [Symbol.iterator](): SetIterator; +} + +/** + * Describes an {@link Iterator} produced by the runtime that inherits from the intrinsic `Iterator.prototype`. + */ +interface IteratorObject extends Iterator { + [Symbol.iterator](): IteratorObject; +} + +interface MapIterator extends IteratorObject { + [Symbol.iterator](): MapIterator; +} + + +interface MapIterator extends IteratorObject { + [Symbol.iterator](): MapIterator; +}