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

Better typings for Array.concat() #33606

Closed
wants to merge 2 commits into from
Closed

Conversation

jablko
Copy link
Contributor

@jablko jablko commented Sep 26, 2019

Fixes #26378
Fixes #26976

Copy link

@Jessidhia Jessidhia left a comment

Choose a reason for hiding this comment

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

You probably need to keep at least the less-generic overload around as the first overload.

As it is, the free U parameter will prevent inference from working in cases where one is trying to build a homogeneous array; especially when the array includes function or object types that might have methods.

const foo = [(a: string) => a]
const bar = foo.concat(b => b) // implicit any error

@jablko jablko force-pushed the patch-9 branch 2 times, most recently from 337078d to eb23428 Compare September 27, 2019 17:54
@jablko
Copy link
Contributor Author

jablko commented Sep 27, 2019

@Jessidhia Thank you for this feedback! I've now updated the PR accordingly.

@jablko jablko force-pushed the patch-9 branch 2 times, most recently from 34b5a8e to d24988c Compare October 3, 2019 17:16
@jablko jablko force-pushed the patch-9 branch 3 times, most recently from 47ac9d2 to 2d8c8ea Compare October 9, 2019 16:37
@jablko jablko force-pushed the patch-9 branch 2 times, most recently from 944ef0f to 0693442 Compare October 19, 2019 18:34
@jablko jablko force-pushed the patch-9 branch 2 times, most recently from 5336214 to 40063fe Compare November 16, 2019 15:24
@jablko jablko force-pushed the patch-9 branch 5 times, most recently from 50c57c6 to 3ec86d2 Compare November 28, 2019 14:51
@jablko jablko force-pushed the patch-9 branch 3 times, most recently from cbf4fc2 to dd89dbe Compare January 25, 2020 20:23
@RyanCavanaugh
Copy link
Member

Rolled into #33645

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.

Add additional overloads to Array.prototype.concat Support concat operations on arrays of different types
3 participants