Skip to content

mergeMapLikes: Improve type#22237

Merged
4 commits merged into
masterfrom
mergeMapLikes
Mar 1, 2018
Merged

mergeMapLikes: Improve type#22237
4 commits merged into
masterfrom
mergeMapLikes

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Feb 28, 2018

Previously this would allow to merge completely unrelated types.

@ghost ghost requested a review from sheetalkamat February 28, 2018 19:20
Comment thread src/server/utilities.ts Outdated
}

export function mergeMapLikes(target: MapLike<any>, source: MapLike<any>): void {
export function mergeMapLikes<T>(target: T, source: T): void {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why not MapLike<T> and MapLike<T>? If not, should source have the type Partial<T>?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

T extends object ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

If we write MapLike<T> that disallows to call it on a non-MapLike like FormatCodeSettings. We're actually never calling this function on MapLikes... but you're right that source could be Partial<T>.

@ghost ghost merged commit 03ba8a0 into master Mar 1, 2018
@ghost ghost deleted the mergeMapLikes branch March 1, 2018 15:35
@microsoft microsoft locked and limited conversation to collaborators Jul 3, 2018
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants