UNPKG

fui-fancyui

Version:
18 lines (17 loc) 789 B
/** * Advanced TypeScript spacing calculator with conditional return type * Uses conditional types to automatically infer the return type * based on the withPx parameter, without using 'any' type */ /** * Defines the return type based on the withPx parameter */ type SpacingResult<T extends boolean> = T extends true ? string : number; /** * Calculates spacing value based on a step number with dynamic return type * @param step - The step in the spacing scale (1, 2, 3, etc.) * @param withPx - When true, returns string with 'px' suffix; when false, returns number * @returns Either a number or a string with 'px' suffix based on withPx parameter */ export declare function generateSpacingSize<T extends boolean = false>(step: number, withPx?: T): SpacingResult<T>; export {};