Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improper conversion of [...string] #45

Closed
axtens opened this issue Jul 29, 2019 · 3 comments
Closed

Improper conversion of [...string] #45

axtens opened this issue Jul 29, 2019 · 3 comments

Comments

@axtens
Copy link

axtens commented Jul 29, 2019

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
Copy link
Collaborator

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

@PopGoesTheWza
Copy link
Collaborator

@axtens Can you provide an update about this issue?

@flaming-codes
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants