/** * Common utilities * @description 通用工具函数库,严格类型化 */ export declare const generateId: (prefix?: string) => string; /** * 函数类型定义 */ type AnyFunction = (...args: unknown[]) => unknown; /** * 可取消函数类型 */ interface CancelableFunction { (...args: Parameters): ReturnType; cancel: () => void; } /** * 防抖函数 */ export declare const debounce: (fn: T, delay: number) => CancelableFunction; /** * 节流函数 */ export declare const throttle: (fn: T, delay: number) => CancelableFunction; /** * 深拷贝 */ export declare const deepClone: (obj: T, cache?: WeakMap) => T; /** * 深度合并对象 */ export declare const deepMerge: >(target: T, ...sources: Partial[]) => T; /** * 将值转换为数组 */ export declare const toArray: (val: T | T[]) => T[]; /** * 首字母大写 */ export declare const capitalize: (str: string) => string; /** * 转换为 kebab-case */ export declare const kebabCase: (str: string) => string; /** * 转换为 camelCase */ export declare const camelCase: (str: string) => string; /** * 休眠函数 */ export declare const sleep: (ms: number) => Promise; /** * 访问对象嵌套路径的值 */ export declare const get: (obj: Record, path: string, defaultValue?: T) => T; /** * 设置对象嵌套路径的值 */ export declare const set: >(obj: T, path: string, value: unknown) => T; /** * 异步函数重试 */ export declare const retry: (fn: () => Promise, retries?: number, delay?: number) => Promise; export {};