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

Eliminate needless custom assign utility. #5973

Merged
merged 2 commits into from Feb 21, 2020
Merged

Conversation

benjamn
Copy link
Member

@benjamn benjamn commented Feb 20, 2020

Not only do we have the __assign helper from tslib to handle { ...object, ...spread } syntax, and folks can easily polyfill Object.assign in older browsers, but we were using this assign helper in only one place, and we didn't really need it there.

Saves 78 bytes of bundle size (minified + gzip), which is pretty good for such an easy change.

Not only do we have the tslib __assign helper, and folks can easily
polyfill Object.assign in older browsers, but we were only using this
helper in one place, and we didn't really need it, even there.

Saves 78 bytes of bundle size (minified + gzip), which is pretty good for
such an easy change.
@codecov

This comment has been minimized.

if (typeof source === 'undefined' || source === null) {
return;
}
Object.keys(source).forEach(key => {
Copy link
Member Author

Choose a reason for hiding this comment

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

This wasn't even correct, because Object.assign is specified to copy own Symbols as well as own keys.

Copy link
Member

Choose a reason for hiding this comment

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

Yikes - nice catch!

Copy link
Member

@hwillson hwillson left a comment

Choose a reason for hiding this comment

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

Awesome @benjamn!

@benjamn benjamn merged commit af2c69c into master Feb 21, 2020
@benjamn benjamn deleted the eliminate-assign-utility branch February 21, 2020 16:02
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants