03060-easy-unshift
Easy
array

チャレンジのソース: type-challenges/03060-easy-unshift

Array.unshiftの型バージョンを実装します。

例えば:

type Result = Unshift<[1, 2], 0> // [0, 1, 2]

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

type cases = [
  Expect<Equal<Unshift<[], 1>, [1]>>,
  Expect<Equal<Unshift<[1, 2], 0>, [0, 1, 2]>>,
  Expect<Equal<Unshift<['1', 2, '3'], boolean>, [boolean, '1', 2, '3']>>,
]