Skip to content

Fix support for Node.js 4 (#2414) #2455

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

Merged
merged 1 commit into from
Jan 26, 2017

Conversation

rosen-vladimirov
Copy link
Contributor

@rosen-vladimirov rosen-vladimirov commented Jan 26, 2017

As the code is transpiled to ES6, spread operator from TypeScript is transpiled to spread operator in JavaScript.
However this usage is not available in Node.js 4:

let { normalizedPropertyName, projectConfigurations } = this.validateUpdatePropertyInfo(propertyName, propertyValues, configurations);

// Replaced with:
let data = this.validateUpdatePropertyInfo(propertyName, propertyValues, configurations),
	normalizedPropertyName = data.normalizedPropertyName,
	projectConfigurations = data.projectConfigurations;

This is limitation of Node.js 4 itself. Spread operator is not available there (it's available only for arrays, i.e.

const arr = [ 1, 2, 3 ]
console.log([ 0, ...arr ]);
	[ 0, 1, 2, 3 ]

NOTE: This is cherry-picked from master.

As the code is transpiled to ES6, spread operator from TypeScript is transpiled to spread operator in JavaScript.
However this usage is not available in Node.js 4:
```TypeScript
let { normalizedPropertyName, projectConfigurations } = this.validateUpdatePropertyInfo(propertyName, propertyValues, configurations);

// Replaced with:
let data = this.validateUpdatePropertyInfo(propertyName, propertyValues, configurations),
	normalizedPropertyName = data.normalizedPropertyName,
	projectConfigurations = data.projectConfigurations;
```

This is limitation of Node.js 4 itself. Spread operator is not available there (it's available only for arrays, i.e.
```JavaScript
const arr = [ 1, 2, 3 ]
console.log([ 0, ...arr ]);
	[ 0, 1, 2, 3 ]
```
@rosen-vladimirov rosen-vladimirov merged commit 7cce4ff into release Jan 26, 2017
@rosen-vladimirov rosen-vladimirov deleted the vladimirov/fix-support-for-node-4 branch January 26, 2017 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants