Closed
Description
openedon Nov 1, 2018
Environment: https://github.com/convoyinc/apollo-cache-hermes/tree/8088c19
Specifics:
importHelpers
istrue
target
ises5
downlevelIteration
istrue
- TypeScript version: 2.8.4 (~2.8.0)
- tslib version: 1.9.3 (^1.9.0)
Helpful reproduction repo built by @alexanderson1993 over in convoyinc/apollo-cache-hermes#382
When run on react-native android (and presumably older versions of Chrome), the following code infinite loops on tslib.__values
(it emits undefined
forever)
export class QueryInfo {
// …
public readonly variables: Set<string>;
// …
private _assertAllVariablesDeclared(messages: string[], declaredVariables: Set<string>) {
for (const name of this.variables) {
if (!declaredVariables.has(name)) {
messages.push(`Variable $${name} is used, but not declared`);
}
}
}
// …
}
Emitted source:
// …
QueryInfo.prototype._assertAllVariablesDeclared = function (messages, declaredVariables) {
try {
for (var _a = tslib_1.__values(this.variables), _b = _a.next(); !_b.done; _b = _a.next()) {
var name_1 = _b.value;
if (!declaredVariables.has(name_1)) {
messages.push("Variable $" + name_1 + " is used, but not declared");
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
}
finally { if (e_1) throw e_1.error; }
}
var e_1, _c;
};
// …
Observed: for (const name of this.variables) {
loops forever, assigning undefined
to name
on each iteration
Activity