export type PathParam = string | number | boolean; export type QueryParam = PathParam | Record; export type TemplatePathParams = Record; export type TemplatePath = string & { [key in keyof T]?: string; }; export type InferPathParams

= P extends TemplatePath ? T : never; /** * Returns an interpolated path with placeholder parameters replaced with actual parameters. * * @param templatePath The path template to interpolate. * @param params The parameters to interpolate. * * @returns Interpolated path. * * @throws Error if params can't fully interpolate the template path. * * @example * getInterpolatedPath("/users/:userId", { userId: 123 }); -> "/users/123" */ export declare const getInterpolatedPath: (templatePath: string | TemplatePath, params: T) => string; /** * Determines if params are sufficient to interpolate a template path. * * @param templatePath The template path. * @param params Interpolation parameters. * * @returns whether the params are sufficient to interpolate the path or not. * * @example * paramsSufficientForPath("/users/:userId/properties/:propertyId", { userId: 123 }); -> false * paramsSufficientForPath("/users/:userId/properties/:propertyId", { userId: 123, status: "ACTIVE" }); -> false * paramsSufficientForPath("/users/:userId/properties/:propertyId", { userId: 123, propertyId: 432 }); -> true */ export declare const paramsSufficientForPath: (templatePath: string, params: Record) => boolean; export interface AddSearchParamsOptions { arrayParamStyle?: 'comma' | 'append'; mode?: 'string' | 'json'; } /** * Appends search parameters to a route path or URL. * * @param routePath The path to which search params will be added. * @param searchParams The search params to add to path. * @param options Configuration options. * * @returns The full path with search params added. * * @example * addSearchParams("/users", { userId: 123, status: "ACTIVE" }); -> "/users?userId=123&status=ACTIVE" * * @example * const routePath = '/products'; * const searchParams = { * category: 'electronics', * price: 100, * color: ['red', 'blue'] * }; * * const options = { * arrayParamStyle: 'comma', * mode: 'string' * }; * * const modifiedURL = addSearchParams(routePath, searchParams, options); * console.log(modifiedURL); * // Output: "/products?category=electronics&price=100&color=red,blue" */ export declare const addSearchParams: (routePath: string, searchParams: Record, { arrayParamStyle, mode }?: AddSearchParamsOptions) => string; /** * Determines if a path matches a template path. * * @param templatePath The template path. * @param testPath The path to test. * * @returns whether the path matches or not. */ export declare const matchPath: (templatePath: string, testPath: string) => boolean;