grant/ts2gas

Improper conversion of [...string]

axtens opened this issue · 3 comments

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.

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

@axtens Can you provide an update about this issue?

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