Description
Since #32514 spreading always handle 2 objects at the time.
It has been suggested that because of that assign
helper could be simplified to handle 2 arguments - instead of variadic amount - #32514 (comment) . I believe this would be slightly beneficial for the compiled output etc so I would like to propose pursuing this simplification and I can offer my intent to implement this. Would only need to know if there is something else that needs to be done for this except changing the code. I know tslib has to be updated, but ain't sure how its code is generated. Or are helpers just inlined there manually?
Requested description
I propose to add merge
helper which would be implemented like this
export var __merge = function __merge(target, source) {
for (var prop in source) if (Object.prototype.hasOwnProperty.call(source, prop)) target[prop] = source[prop];
return target;
}
It's just a simplification over assign
(which supports variadic list of arguments) - but this one handles only 2 arguments: target & source (and this is sufficient since #32514 )