/** Pick given properties in object */ export function pick(obj: T, paths: K[]): Pick { const result = {} as Pick Object.keys(obj as any).forEach((key) => { if (!paths.includes(key as K)) return // @ts-expect-error result[key] = obj[key] }) return result as Pick } /** Omit given properties from object */ export function omit, K extends keyof T>(object: T, keys: K[]) { const result: Record = {} Object.keys(object).forEach((key) => { if (keys.includes(key as K)) return result[key] = object[key] }) return result as Omit }