45. implement Slice<A, S, E>

TypeScript

  - accepted / - tried

Just like what Array.prototype.slice() does, please implement Slice<A, S, E>.

type A = Slice<[1,2,3,4], 0, 2> // [1, 2]
type B = Slice<[1,2,3,4], 2> // [3, 4]
type C = Slice<[number, boolean, bigint], 2, 5> // [bigint]
type D = Slice<[string, boolean], 0, 1> // [string]
type E = Slice<[number, boolean, bigint], 5, 6> // []

Let's assume end index E won't be negative

Let's try to solve this problem within 10 minutes.

(6)