import type { InferRoutes, RouterDefinition, Router as Handle, RoutesShape } from "../types"; /** * Creates a {@link RouterDefinition} — the per-app entrypoint that owns * the routes for an entire deployable. * * The urls type is inferred from each entry's `name`/`url` pair via a * `const` generic — no explicit `` annotation needed. The returned * value carries: * - `routes.Router` — a pre-bound `` component (mount it directly, * no `using` prop required) * - `routes.url.X(params)` — typed builders for every named route * - `routes.useContext()` — hook returning the typed navigation handle * * @example * ```tsx * // app/routes.ts * import { Router, route } from "react-wayfinder"; * * export const routes = Router([ * route({ name: "home", url: "/", match: () => }), * route({ * name: "user", * url: "/users/:id", * async data({ params, signal }) { * return fetchUser(params.id, { signal }); * }, * match({ status, params, data, error }) { * if (status === "loading") return ; * if (error) return

{error.message}

; * if (data) return ; * return null; * }, * }), * route({ name: "signOut", url: "/sign-out", redirect: "/" }), * route({ url: "*", match: () => }), * ]); * * // mount at root — no `using` prop, no children required * {children}; * * // anywhere inside — auto-typed * const router = routes.useContext(); * User 42; * router.navigate.push(router.url.home()); * ``` */ export declare function Router(entries: Entries): RouterDefinition>; export type Router = Handle;