“Tuple” 方法
_.TupleByUnionUnshift<tuple, type>
TupleByUnionUnshift
的 Union
情况专用处理函数
将一个类型添加元组的开头,并返回「暴力枚举后」的「元组联合类型」
参数
tuple (Tuple): 需要处理的元组
type (unknown): 需要被添加到元组中的类型
返回
tuple (Tuple): 首部被添加一项后的元组
例子
type TupleAfterUnionUnshift = _.TupleByUnionUnshift<['angular'], 'react' | 'vue'>;
// => ['react', 'angular'] | ['vue', 'angular']
type TupleAfterUnionUnshift = _.TupleByUnionUnshift<['angular'] | ['solid'], 'react' | 'vue'>;
// => ['react', 'angular'] | ['vue', 'angular'] | ['react', 'solid'] | ['vue', 'solid']
// diff with TupleByUnshift
type TupleAfterUnshift = _.TupleByUnshift<['angular'], 'react' | 'vue'>;
// => ['react' | 'vue', 'angular']