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

Rest paramters causing error in node 4.2.6 #7215

Closed
pranaydutta89 opened this issue Feb 24, 2016 · 6 comments
Closed

Rest paramters causing error in node 4.2.6 #7215

pranaydutta89 opened this issue Feb 24, 2016 · 6 comments
Labels
Question An issue which isn't directly actionable in code

Comments

@pranaydutta89
Copy link

I am using typescript for my nodejs app, in es6 compilation mode, in some of my classes the generated js code looks like

class mediasController extends lib.baseClasses.apiControllerAsyncBase().apiControllerAsync { constructor(...args) { super(...args); this.xyz = {}; }

it has the es6 rest parameters which nodejs says as "unexpected token...",
please provide me with an alternative or solution of the same .

@RyanCavanaugh RyanCavanaugh added the Question An issue which isn't directly actionable in code label Feb 24, 2016
@RyanCavanaugh
Copy link
Member

If you target ES6, TypeScript is going to emit ES6 code (which includes rest args).

If your runtime doesn't support all ES6 features, you can target ES5, or choose not to use the unsupported ES6 features.

@pranaydutta89
Copy link
Author

i cannot use es5 since i am using async/await and typescript is automatically generating the rest params how to stop compiler to generate the rest params??

@mhegazy
Copy link
Contributor

mhegazy commented Feb 25, 2016

here is the issue tracking more granular transformations: #4692

@pranaydutta89
Copy link
Author

@mhegazy great ,in which version it is being targeted ??

@mhegazy
Copy link
Contributor

mhegazy commented Mar 3, 2016

We are starting with breaking up the lib in the next release, see #6974, the emit transformations comes next.

@bennyyip
Copy link

@pranaydutta89 I came across the same problem as yours.
Adding flag --harmony_rest_parameters to launch the app could solve it.
see ECMAScript 2015 (ES6) in Node.js

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Question An issue which isn't directly actionable in code
Projects
None yet
Development

No branches or pull requests

4 participants