Implement the generic version of Array.push
For example:
type Result = Push<[1, 2], '3'> // [1, 2, '3']
/* _____________ Your Code Here _____________ */
type Push<T extends any[], U> = [...T, U]
/* _____________ Test Cases _____________ */
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]>>,
]
标签:Typescript,_____________,75,Expect,Easy,Push,type From: https://www.cnblogs.com/Answer1215/p/16837963.html