Skip to content

v0.7.0

Latest

Choose a tag to compare

@sbesh91 sbesh91 released this 15 Jun 16:23

hono-preact v0.7.0: release notes

Released: 2026-06-15

v0.7.0 makes routing typed in both directions. The active-state hooks now
autocomplete and typecheck against your route table and hand back typed params,
and a new buildPath helper builds concrete URLs from a route pattern with the
params checked at compile time. No breaking runtime changes.

Highlights

buildPath: typed dynamic links

buildPath(pattern, params) interpolates a registered route pattern into a
concrete path string, with the pattern autocompleted from your route table and
the params object enforced by the pattern's dynamic segments:

buildPath('/demo/projects/:projectId', { projectId: p.slug }); // '/demo/projects/abc'
buildPath('/docs/components'); // no params arg for a param-less route

A wrong param key or a missing param is a compile error instead of a silent bad
URL, and the helper composes with everything that takes a path string:
useNavigate(), <a href>, <NavLink href>, and usePrefetch().

Typed active-state matching

useRouteMatch() now returns the matched route's typed params (for a known
route literal) instead of a bare Record<string, string>, so the params you
read are the ones the pattern actually declares:

const params = useRouteMatch('/posts/:id'); // { id: string } | null

useRouteMatch(), useRouteActive(), and NavLink's match prop now
autocomplete the routes in your registered route table. They stay permissive:
any path string is still accepted, so content-glob routes (the kind generated by
contentRoutes(), which the pure-type engine cannot enumerate) keep working.

This builds on the existing typed-route-params system; like that system, the
typing is pure type-level inference keyed off the route tree, with no codegen and
no build step.

Breaking changes

None at runtime. One type-level refinement worth noting: because
useRouteMatch() now returns the route's declared params rather than an open
Record<string, string>, reading a param the pattern does not declare becomes a
type error. Read the params the route actually defines (the common case is
already correct).

Upgrading

npm install hono-preact@0.7.0

Scaffold a new app with the matching CLI:

npm create hono-preact@0.7.0

v0.7.0 is a drop-in upgrade for typical apps. hono-preact-ui is unchanged in
this release and keeps its own version line.