03062-medium-shift
Medium
array

チャレンジのソース: type-challenges/03062-medium-shift

Implement the type version of Array.shift

For example

type Result = Shift<[3, 2, 1]> // [2, 1]

Loading...
import type { Equal, Expect } from '@type-challenges/utils'

type cases = [
  // @ts-expect-error
  Shift<unknown>,
  Expect<Equal<Shift<[]>, []>>,
  Expect<Equal<Shift<[1]>, []>>,
  Expect<Equal<Shift<[3, 2, 1]>, [2, 1]>>,
  Expect<Equal<Shift<['a', 'b', 'c', 'd']>, ['b', 'c', 'd']>>,
]