Skip to content

Latest commit

 

History

History
13 lines (8 loc) · 1.35 KB

File metadata and controls

13 lines (8 loc) · 1.35 KB

Slice extreme #array

by Anthony Fu @antfu

Take the Challenge

Implement the JavaScript Array.slice function in the type system. Slice<Arr, Start, End> takes the tree argument. The output should be a subarray of Arr from index Start to End. Indexes with negative numbers should be counted from reversely.

For example

type Arr = [1, 2, 3, 4, 5]
type Result = Slice<Arr, 2, 4> // expected to be [3, 4]

Back Share your Solutions Check out Solutions