-
-
Notifications
You must be signed in to change notification settings - Fork 662
Description
I wanted to use ArraySlice to strongly type Array#slice for known-length tuples, but realized that the current type returns empty arrays for -T['length'] < Start < 0 and -T['length'] < End < 0.
Given the type is stated to be based off of Array.slice, I feel it would make sense to implement such wraparound in the type system as well.
Note
This can be done with only externally-available types, but I feel the utility would make enough sense to warrant augmenting the existing type (and potentially a minor breaking change).
REMARKS
I think the easiest way to do this would be to simply move the existing logic to a helper type, and use a simple wrapper to adjust Start/End manually.
I'd be willing to work on this if desired - the above link already has an (IMO) decently functional