import { PickEquality } from '../types'; /** Method map for pick.wrap - maps names to selector functions */ type MethodMap = Record any>; /** Capitalize first letter of a string */ type Capitalize = S extends `${infer F}${infer R}` ? `${Uppercase}${R}` : S; /** Add prefix to method names and capitalize */ type PrefixedMethods = { [K in keyof TMethods as `${TPrefix}${Capitalize}`]: TMethods[K]; }; /** Pick function interface with wrap method */ export interface PickFn { /** Pick a computed value with fine-grained change detection */ (selector: () => T, equality?: PickEquality): T; /** * Wrap a single function so it returns pick-wrapped results. * * @example * ```ts * const getFullName = pick.wrap( * () => `${state.firstName} ${state.lastName}`, * "strict" * ); * // In selector: * return { fullName: getFullName() }; * ``` */ wrap(fn: (...args: TArgs) => TResult, equality?: PickEquality): (...args: TArgs) => TResult; /** * Wrap multiple methods with a prefix. * * @example * ```ts * const methods = pick.wrap("pick", { * count: () => state.count, * name: () => state.name, * }); * // Returns: { pickCount: () => state.count, pickName: () => state.name } * ``` */ wrap(prefix: TPrefix, methods: TMethods, equality?: PickEquality): PrefixedMethods; /** * Wrap multiple methods without a prefix. * * @example * ```ts * const methods = pick.wrap({ * count: () => state.count, * name: () => state.name, * }); * // Returns: { count: () => pick(() => state.count), name: () => pick(() => state.name) } * ``` */ wrap(methods: TMethods, equality?: PickEquality): TMethods; } /** pick function with wrap method attached */ export declare const pick: PickFn; export {}; //# sourceMappingURL=pick.d.ts.map