72. 去除数组指定元素
中等
实现通用的工具类型 Without<T, U>
,它接收一个数组 T
和一个数字或数组 U
,并返回一个不包含 U
中元素的数组。
例如:
type Res = Without<[1, 2], 1>; // expected to be [2]
type Res1 = Without<[1, 2, 4, 1, 5], [1, 2]>; // expected to be [4, 5]
type Res2 = Without<[2, 3, 2, 3, 2, 3, 2, 3], [2, 3]>; // expected to be []