-
Notifications
You must be signed in to change notification settings - Fork 3k
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
fix(Symbol.iterator): correctly handle case where Symbol constructor itself is not defined #3394
Conversation
Generated by 🚫 dangerJS |
by the library. However it will provide clues to users on older | ||
browsers why things like `from(iterable)` doesn't work. */ | ||
if (!Symbol || !Symbol.iterator) { | ||
console.warn('RxJS: Symbol.observable does not exist'); |
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.
s/observable/iterator too. I missed this before 🙂
src/internal/symbol/iterator.ts
Outdated
} | ||
|
||
/** The native Symbol.iterator instance or a string */ | ||
export const iterator = Symbol && Symbol.iterator || '@@iterator'; | ||
export const iterator = getSymbolIterator(root); |
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.
We actually want to get rid of root
at some point. It's caused more issues than it's fixed.
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.
do you have alternatives for testing?
…itself is not defined
@@ -1,14 +1,17 @@ | |||
export function getSymbolIterator(): symbol { | |||
/* NOTE: Warning users that they don't have a Symbol.iterator |
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.
So we should probably just remove the console.warn (and related comment) and document it in the migration docs. Because it's going to prompt users to add polyfills they don't need, or even to come file issues that they're getting warnings they don't understand.
I can dismiss my own review if I want to! :D
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Follow up to #3389. This also makes the type a real
symbol
instead ofany
(return type ofgetSymbolIterator
does it)#3387 also needs to be adjusted as well.