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

feat: Add type information to __assign(…) helper function #83

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ExE-Boss
Copy link
Contributor

@ExE-Boss ExE-Boss commented Jan 6, 2020

This adds typed overloads to __assign, along with a TSDoc comment copied from lib.es2015.core.d.ts#ObjectConstructor.assign(…).


review?(@DanielRosenwasser)

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Jan 15, 2020

Is there any particular reason you're looking to type these more strictly?

@ExE-Boss
Copy link
Contributor Author

Well, I’d like to eventually add type information to all TSLib helpers.

@DanielRosenwasser
Copy link
Member

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.

@ExE-Boss
Copy link
Contributor Author

ExE-Boss commented Jan 15, 2020

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;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants