tslib known bugs

npm

4 known bugs in tslib, with affected versions, fixes and workarounds. Sourced from upstream issue trackers.

4
bugs
Known bugs
SeverityAffectedFixed inTitleStatusSource
mediumany\u2014
Projects that depend on tslib inherit the Microsoft copyright
Hello, If I build an app that combines tslib with other code -- e.g. use TypeScript in an app -- as far as I understand the license header on https://github.com/Microsoft/tslib/blob/master/tslib.js, it requires me to include that copyright+license in the resulting product. Is that intentional? I think when I use the TypeScript compiler without the `--importHelpers` flag, I do not have this additional requirement.
fixedgithub:47
medium2.8.4\u2014
__values causes an infinite loop on Sets when Symbol.iterator isn't defined
Environment: https://github.com/convoyinc/apollo-cache-hermes/tree/8088c19 Specifics: * [`importHelpers` is `true`](https://github.com/convoyinc/apollo-cache-hermes/blob/8088c19/tsconfig.json#L5) * [`target` is `es5`](https://github.com/convoyinc/apollo-cache-hermes/blob/8088c19/tsconfig.json#L24) * [`downlevelIteration` is `true`](https://github.com/convoyinc/apollo-cache-hermes/blob/8088c19/tsconfig.json#L4) * [TypeScript version: 2.8.4 (~2.8.0)](https://github.com/convoyinc/apollo-cache-hermes/blob/8088c19/yarn.lock#L3926) * [tslib version: 1.9.3 (^1.9.0)](https://github.com/convoyinc/apollo-cache-hermes/blob/8088c19/package.json#L73) 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 emits `undefined` forever) [TypeScript source](https://github.com/convoyinc/apollo-cache-hermes/blob/master/src/context/QueryInfo.ts#L85): ```ts 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: ```js // … 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
fixedgithub:59
mediumany\u2014
Remove .gitattributes from published package
The published package contains your `.gitattributes` file.
fixedgithub:60
medium2.0.0\u2014
TSLib 2.0.0 causing bundling issues
Hi there, TSLib 2.0.0 seems to be causing bundling issues due to the use of `exports` as a parameter name in the `__exportStar` function. Starting with v2 the export star function calls another function called `__createBinding`. When this is bundled a simple bundler will add `exports.` in front of the create binding call (which is a common technique in bundlers) but as there is a parameter called `exports` the call is referencing the incorrect variable. Even TypeScript itself will generate similar code as shown here https://www.typescriptlang.org/play/?experimentalDecorators=true&emitDecoratorMetadata=true&module=1&ssl=12&ssc=1&pln=9&pc=1#code/KYDwDg9gTgLgBANwIZTgfTQYysJNgBCAlgHYAmpA5nALxwDyARgFbCYwB02u+cA-HAAUAMwCuJdkQglBEADRwAtgoDWqgEwBKOAG8AUHENwiwoSvW0adcWWDDSwMtvO04KgNwGjTVuw637EmAABSgIMGBYAE9ZDQUdOGASUUVIpEYAG2AALjgYKFFgBUpgGFyxCRgpGW0EnBhRKBIlAG0VAF13OABfHs1Pbu1ckXFJaVilVQ1ar0MTMwsra3I7Byc3RbdPIzgINvV210U2zq9Bzz1QSFg4CrHmjCvoGABlGBRBZUTwZ4BnGZ2wmgQmQqDAxmaim080E4IAhFY4AAiAJIUQZGBIuAAMmxcDhT1gvw4AAskL96AB3EihcKRGAxMCabQYbh4QikCgkSiCQkwX4KL5MgZAA I don't see a need for the parameter to be called exports so I think it would be acceptable to simply to change the parameter name to avoid this issue.
fixedgithub:120
API access

Get this data programmatically \u2014 free, no authentication.

curl https://depscope.dev/api/bugs/npm/tslib
tslib bugs — known issues per version | DepScope | DepScope