Below is the interface of RouterContext
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;
}
As for how to resolve error , you can resolve it by giving it types as given in the interface , suppose if you don't want to use type you can just replace it with below code,
{ request, response, state }: RouterContext<string,any,any>,