-
Notifications
You must be signed in to change notification settings - Fork 948
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
Remove Symbol.iterator #1330
Conversation
There was a problem hiding this 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> |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better, thanks.
50065eb
to
ef455a7
Compare
This allows use of Firestore in IE11 without Polyfills.
Fixes #1308