Skip to content

ParamStash

reference
1 min readUpdated

Kind: Type

Source: src/router.ts

Type representing a stash of parameters.

ParamStash represents the parameters collected during router matching. It acts as the typed value passed between route matching logic and code that handles the matched route.

Definition

ts
string[]

Diagram

mermaid
graph LR
  Route[Route match] --> Stash[ParamStash]
  Stash --> Handler[Route handler]

Usage

ts
import type { ParamStash } from "./router";

function handleMatchedRoute(params: ParamStash): ParamStash {
  // Pass the matched parameter stash to downstream route logic.
  return params;
}

AI Coding Instructions

  • Import ParamStash with import type when it is only used for TypeScript annotations.
  • Keep parameter collection and parameter consumption typed as ParamStash at router boundaries.
  • Do not replace ParamStash with an untyped object when forwarding matched route parameters.
  • Update route matching code and handler signatures together when the parameter stash shape changes.

Was this page helpful?

Download as PDF
ParamStash — Hono (narrator proof)