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

TypeScript - Add overload for ReadonlyArray #7

Merged
merged 4 commits into from
Apr 7, 2019

Conversation

ajafff
Copy link
Contributor

@ajafff ajafff commented Apr 5, 2019

If passed an array arrify returns the same refrence. With the current type declarations this would convert a ReadonlyArray<T> to a mutable Array<T> because it matches the overload with Iterable<T>.
This adds an overload to make sure readonly arrays are not mutated after being passed through arrify.

@sindresorhus
Copy link
Owner

// @BendingBender

index.test-d.ts Outdated Show resolved Hide resolved
index.d.ts Show resolved Hide resolved
BendingBender and others added 2 commits April 5, 2019 21:53
Co-Authored-By: ajafff <klaus.meinhardt1@gmail.com>
@BendingBender
Copy link
Contributor

Thank you!

@sindresorhus sindresorhus changed the title typescript: add overload for ReadonlyArray TypeScript - Add overload for ReadonlyArray Apr 7, 2019
@sindresorhus sindresorhus merged commit f789ce5 into sindresorhus:master Apr 7, 2019
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.

None yet

3 participants