| 1 |
|
| 2 | import { Equal } from "./types/utils.js";
|
| 3 | import { Pages } from "./types/register.js";
|
| 4 |
|
| 5 | //#region lib/href.d.ts
|
| 6 | type Args = { [K in keyof Pages]: ToArgs<Pages[K]["params"]> };
|
| 7 | type ToArgs<Params extends Record<string, string | undefined>> = Equal<Params, {}> extends true ? [] : Partial<Params> extends Params ? [Params] | [] : [Params];
|
| 8 | /**
|
| 9 | Returns a resolved URL path for the specified route.
|
| 10 |
|
| 11 | ```tsx
|
| 12 | const h = href("/:lang?/about", { lang: "en" })
|
| 13 | // -> `/en/about`
|
| 14 |
|
| 15 | <Link to={href("/products/:id", { id: "abc123" })} />
|
| 16 | ```
|
| 17 | */
|
| 18 | declare function href<Path extends keyof Args>(path: Path, ...args: Args[Path]): string;
|
| 19 | //#endregion
|
| 20 | export { href }; |
| \ | No newline at end of file |