copy-anything icon indicating copy to clipboard operation
copy-anything copied to clipboard

props should be typed

Open ShravanSunder opened this issue 1 year ago • 0 comments

props should be typed to keyof T, we will get type safety this way

export type Options<T> = {
    props?: (keyof T)[];
    nonenumerable?: boolean;
};
/**
 * Copy (clone) an object and all its props recursively to get rid of any prop referenced of the original object. Arrays are also cloned, however objects inside arrays are still linked.
 *
 * @param target Target can be anything
 * @param [options = {}] Options can be `props` or `nonenumerable`
 * @returns the target with replaced values
 */
export declare function copy<T>(target: T, options?: Options<T>): T;

ShravanSunder avatar Apr 21 '23 23:04 ShravanSunder