Closed nevir closed 5 years ago
Other info:
Symbol.iterator
is a string with value @@iterator
o[Symbol.iterator]
resolves to a function.typeof Symbol
resolves to undefined
. wtf? (Ah! it appears to be getting replaced during compilation by RN's packager…)^ found by inserting the following line into __values
:
throw new Error("typeof Symbol: " + typeof Symbol + ", typeof o[Symbol.iterator]: " + typeof o[Symbol.iterator]);
Output:
The root cause here appears to be a polyfill bug in RN's android environment, I think. Edit: yeah: Appears to be https://github.com/facebook/react-native/issues/4676
However, I'm wondering if tslib should also handle this case a bit more gracefully?
Environment: https://github.com/convoyinc/apollo-cache-hermes/tree/8088c19
Specifics:
importHelpers
istrue
target
ises5
downlevelIteration
istrue
Helpful reproduction repo built by @alexanderson1993 over in https://github.com/convoyinc/apollo-cache-hermes/issues/382
When run on react-native android (and presumably older versions of Chrome), the following code infinite loops on
tslib.__values
(it emitsundefined
forever)TypeScript source:
Emitted source:
Observed:
for (const name of this.variables) {
loops forever, assigningundefined
toname
on each iteration