03057-easy-push
Easy
array

チャレンジのソース: type-challenges/03057-easy-push

Array.pushのジェネリックバージョンを実装します。

例えば:

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

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

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