Skip to content

TypeScript - Add overload for ReadonlyArray#7

Merged
sindresorhus merged 4 commits intosindresorhus:masterfrom
ajafff:readonlyarray-overload
Apr 7, 2019
Merged

TypeScript - Add overload for ReadonlyArray#7
sindresorhus merged 4 commits intosindresorhus:masterfrom
ajafff:readonlyarray-overload

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

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.

3 participants