Skip to content

Remove Symbol.iterator #1330

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

Merged
merged 4 commits into from
Oct 23, 2018
Merged

Remove Symbol.iterator #1330

merged 4 commits into from
Oct 23, 2018

Conversation

schmidt-sebastian
Copy link
Contributor

This allows use of Firestore in IE11 without Polyfills.

Fixes #1308

Copy link
Contributor

@mikelehen mikelehen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're in a hurry to get this released, then this is perhaps okay... but it's making my brain hurt.

// tslint:disable-next-line:no-any Accept any kind of `forEach`.
collection: { forEach: ((cb: ((k: K, ...args: any[]) => void)) => void) },
// tslint:disable-next-line:no-any Accept any kind of callback.
f: (k: K, ...args: any[]) => PersistencePromise<void>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh... these type gymnastics are pretty crazy. Seems like there has to be a better way?

Maybe just define our own Iterable type (with a normal method instead of Symbol.iterator)?

FWIW I wouldn't be surprised if doing ...args in an inner loop is a mildly bad practice for performance reasons. Though I'd have to look at the generated code to be sure.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the type a bit to remove the varargs. This gets us saner types and a bit more type safety (see the related changes in the last commit).

The generated code uses apply().

Copy link
Contributor

@mikelehen mikelehen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better, thanks.

@schmidt-sebastian schmidt-sebastian merged commit 5bac19c into master Oct 23, 2018
@schmidt-sebastian schmidt-sebastian deleted the mrschmidt-foreachable branch October 24, 2018 20:46
@firebase firebase locked and limited conversation to collaborators Oct 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Firestore 5.5.3 uses Symbol(Symbol.iterator) not supported by IE 11
3 participants