sindresorhus / arrify

Convert a value to an array
MIT License
131 stars 28 forks source link

TypeScript - Add overload for `ReadonlyArray` #7

Closed ajafff closed 5 years ago

ajafff commented 5 years ago

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 commented 5 years ago

// @BendingBender

BendingBender commented 5 years ago

Thank you!