cride
Version:
Create isomorphic destructurables.
6 lines (4 loc) • 699 B
TypeScript
type RemoveArrayMethods<T> = Omit<T, "at" | "concat" | "copyWithin" | "entries" | "every" | "fill" | "filter" | "find" | "findIndex" | "findLast" | "findLastIndex" | "flat" | "flatMap" | "forEach" | "includes" | "indexOf" | "join" | "keys" | "lastIndexOf" | "map" | "pop" | "push" | "reduce" | "reduceRight" | "reverse" | "shift" | "slice" | "some" | "sort" | "splice" | "toLocaleString" | "toString" | "unshift" | "values" | "length">;
type Cride<T extends Record<string, unknown>, A extends readonly any[]> = Pick<T, keyof T> & RemoveArrayMethods<A>;
declare const cride: <T extends Record<string, unknown>, A extends readonly any[]>(obj: T, arr: [...A]) => Cride<T, A>;
export { Cride, cride };