Here is the definition of RouterContext interface:
export interface RouterContext<
R extends string,
P extends RouteParams<R> = RouteParams<R>,
// deno-lint-ignore no-explicit-any
S extends State = Record<string, any>,
> extends Context<S> {
/** When matching the route, an array of the capturing groups from the regular expression. */
captures: string[];
/** The routes that were matched for this request. */
matched?: Layer<R, P, S>[];
/** Any parameters parsed from the route when matched. */
params: P;
/** A reference to the router instance. */
router: Router;
/** If the matched route has a `name`, the matched route name is provided here. */
routeName?: string;
/** Overrides the matched path for future route middleware, when a `routerPath` option is not defined on the `Router` options. */
routerPath?: string;
}
To resolve errors, ensure to provide types as specified in the interface. Alternatively, you can use the following code snippet:
{ request, response, state }: RouterContext<string,any,any>,