clasp
clasp copied to clipboard
spread operator(`...`) compiles from typescript into a buggy function that returns an empty array
Code Sample
const a = [...myIter]
Compiled Function
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Expected Behavior
It should return in an Array.
Actual Behavior
It returns and empty array. []
Steps to Reproduce the Problem
- Create typescript file locally.
- Create an iterator.
- use the spread operator inside an array.
Specifications
- Node version (
node -v): 14.16.0 - Version (
clasp -v): 2.4.1 - OS (Mac/Linux/Windows): Windows 10