Wyklucz wartość z typu typscript array
// Exclude Array
type Equal<T, K> = K extends T ? true : false;
type ExcludeArray<T extends any[], K, J extends any[] = []> = T extends [infer first, ...infer Rest]
? Equal<first, K> extends false
? ExcludeArray<Rest, K, [...J, first]>
: ExcludeArray<Rest, K, [...J]>
: J;
type excludeArray = ExcludeArray<['a', 'b', 'c', 'd'], 'c'>; //['a', 'b', 'd']
type excludeArray_2 = ExcludeArray<['a', 'b', 'c', 'd'], 'c'|'d'>; //['a', 'b']
Husnain Syed