tslib
tslib copied to clipboard
feat: Add type information to `__assign(…)` helper function
This adds typed overloads to __assign, along with a TSDoc comment copied from lib.es2015.core.d.ts#ObjectConstructor.assign(…).
review?(@DanielRosenwasser)
Is there any particular reason you're looking to type these more strictly?
Well, I’d like to eventually add type information to all TSLib helpers.
But is there a benefit? This code generally doesn't get consumed by users, and specifically this function has a hard time being accurately typed.
Well, this function acts as an alias for Object.assign if it exists, and uses an approximate implementation if it doesn’t, like in an ES3 environment, which is why I just copied the type information from that.
Arguably, it should be defined as:
export declare var __assign: typeof Object.assign;