Typing nested controlled

Hi, how can I get this param typed?
import { Hono } from "hono"

// reviews controller
export const reviewsController = new Hono()
  .get("/", (c) => c.json({ message: "Hello, world!" }))
  .get("/:reviewId", (c) => {
    const bookId = c.req.param("bookId") // This is not typed. :(
    const reviewId = c.req.param("reviewId")
    return c.json({ bookId, reviewId })
  })

// books controller
export const booksController = new Hono()
  .get("/", (c) => c.json({ message: "Hello, world!" }))
  .get("/:bookId", (c) => c.json({ message: c.req.param("bookId") }))
  .post("/", (c) => c.json({ message: "Hello, world!" }))
  .put("/:bookId", (c) => c.json({ message: c.req.param("bookId") }))
  .delete("/:bookId", (c) => c.json({ message: c.req.param("bookId") }))
  .route("/:bookId/reviews", reviewsController)

// main controller
export const controller = new Hono().route("/api/books", booksController)


I know this is not recommended https://hono.dev/docs/guides/best-practices but I have a 1000+ nested controlled that I need to refactor
Web framework built on Web Standards for Cloudflare Workers, Fastly Compute, Deno, Bun, Vercel, Node.js, and others. Fast, but not only fast.
Was this page helpful?