sindresorhus / arrify

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

type definitions don't work for tuple types #10

Closed ajafff closed 5 years ago

ajafff commented 5 years ago
declare let tuple: [number, string];

const arrified = arrify(tuple);
arrified.push(1);
arrified[0] = 'foo'

Since tuples are arrays, they are returned as is. The type declarations however widen the type to a regular (mutable) array type. Both mutations above should not be allowed.

BendingBender commented 5 years ago

Any suggestions on how to fix this?