TypeScript - itty-router updated in v5
Typing with routers, where middleware can naturally affect not only the same handler, but downstream handlers... is hard.
That said, we've tried to make it all easy for you to extend request types, add support for your own properties, environment variables, etc.
We've broken things down into the simple categories of:
Request Types
This just describes the core request types that everything extends throughout the router. Start here.Routes & Routers
Typing routes (and entire routers) using generics.Request handlers & Middleware
Typing... you guessed it, request handlers and middleware arguments.Response Handlers
For all your downstream response-handler needs, as used in thefinallystage ofAutoRouterandRouter.Additional Arguments
For when you need to type anything beyond therequestin handlers. For example, handling the environment andExecutionContextin Cloudflare Workers.API
The complete TypeScript API. *bows*
