跳到主要内容

Push

在类型系统里实现通用的 Array.push

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

答案

Details
type Push<T extends any[], U> = [...T, U]