grant / ts2gas

A function that transpiles TypeScript to Google Apps Script.
http://npmjs.com/ts2gas
MIT License
88 stars 11 forks source link

Improper conversion of [...string] #45

Closed axtens closed 4 years ago

axtens commented 5 years ago

In VSCode I have

const Reverse = (string:string) => [...string].reverse().join('');

ts2gas converts this to

var Reverse = function (string) { return string.slice().reverse().join(''); };

which fails because slice does not convert string into an array, which reverse() requires. There is a String.prototype.slice but it is not the same as Array.prototype.slice.

PopGoesTheWza commented 5 years ago

@axtens Have you checked if this isn't a known Typescript issue? ts2gas only uses Typescript transpileModule with sensible presets.

PopGoesTheWza commented 4 years ago

@axtens Can you provide an update about this issue?

flaming-codes commented 4 years ago

When using ts2gas 3.6.1 in my project, spreading the string gets handled correctly. I think we can close this issue.