-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Use intersection types in Object.assign defintion #4573
Conversation
* @param target The target object to copy to. | ||
* @param source1 first source objects to copy properties from. | ||
* @param source2 second source objects to copy properties from. | ||
* @param source3 second source objects to copy properties from. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
third
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"source objects" -> "source object"
"to copy properties from" -> "from which to copy properties"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Er... "to copy properties from" is indeed better I believe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, agreed, sorry
* Copy the values of all of the enumerable own properties from one or more source objects to a | ||
* target object. Returns the target object. | ||
* @param target The target object to copy to. | ||
* @param sources One or more source objects from which to copy properties | ||
*/ | ||
assign(target: any, ...sources: any[]): any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you make this take a T
and U
array, then users can specifically pass in a union type for their U
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DanielRosenwasser But then the resulting type would follow the pattern T & (U1 | U2 | U3 ... ) which I don't think is what you want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'd need something like the proposal in #3870.
👍 |
merged manually. |
No description provided.