Skip to content

ES6 and above targets emit Object.assign for object spread #13757

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 4 commits into from
Jan 30, 2017

Conversation

sandersn
Copy link
Member

Previously, they would always emit __assign and its helper definition, even though Object.assign is always available in ES2015 and above.

Fixes #12901

@sandersn
Copy link
Member Author

@rbuckton mind taking a look?

@@ -402,6 +402,11 @@ namespace ts {
};

export function createAssignHelper(context: TransformationContext, attributesSegments: Expression[]) {
if (context.getCompilerOptions().target >= ScriptTarget.ES2015) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are still checking for it under --importHelpers in the checker i believe. you need to change that to ES2015 as well. and also add a test for it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching that. Fixed.

Instead, Object.assign is emitted.
@sandersn sandersn merged commit 6fb2ae2 into master Jan 30, 2017
@sandersn sandersn deleted the es6-target-emits-Object.assign-for-spread branch January 30, 2017 20:52
@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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants