type CleanKey = S extends `"${infer K}"` ? K : S; type KeyName = CleanKey; type KeyVal = K extends `*${string}` ? string[] : string | number; /** Parameters for a given path */ export type PathArgs = unknown extends S ? any : PathKeys extends never ? unknown : KeysToArgs>; /** Like {@link PathArgs} but widened `path: string` collapses to `unknown`, * preventing `(params, body) | (body)` union overloads in ParamFetchWithBody. */ export type SoftPathArgs

= unknown extends P ? any : string extends P ? unknown : PathArgs

; /** Computes the union of keys for a path string */ export type PathKeys = string extends S ? string : S extends `${infer A}\\${':' | '*' | '}'}${infer B}` ? PathKeys | PathKeys : Splits | Splits; type Splits = S extends `${string}${M}${infer K}${M}${infer R}` ? Splits<`${M}${K}`, M> | Splits<`${M}${R}`, M> : S extends (`${string}${M}${infer K}${'/' | '\\' | '%' | '&' | '*' | ':' | '{' | ';' | ',' | '!' | '@'}${infer R}`) ? Splits<`${M}${K}`, M> | Splits : S extends `${string}${M}${infer K}` ? M extends '*' ? `*${K}` : K : never; export type KeysToArgs = { [K in Key as K extends `${string}}` ? KeyName : never]?: KeyVal; } & (Exclude extends never ? unknown : { [K in Key as K extends `${string}}` ? never : KeyName]: KeyVal; }); export type PathArgsAndSearch = unknown extends S ? any : Exclude, `${string}}`> extends never ? Record | undefined : { [K in PathKeys as K extends `${string}}` ? never : KeyName]: KeyVal; } & Record; /** Removes the last :param or *wildcard token */ export type ShortenPath = string extends S ? string : S extends `${infer B}:${infer R}` ? TrimToken<`${B}:${ShortenPath}`> : S extends `${infer B}*${infer R}` ? TrimToken<`${B}*${ShortenPath}`> : ''; type TrimToken = string extends S ? string : S extends `${infer R}:` ? R : S extends `${infer R}*` ? R : S; export type ResourcePath = string; export {}; //# sourceMappingURL=pathTypes.d.ts.map