You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@eratio08params exists only on the RouterContext, which is what is passed to router middleware. The type is inferred be default, so there should be no need to type the ctx. The following works fine:
router.get("/:name",(ctx)=>{ctx.params;// no error});
If you want to strongly type the context, there is a generic you can supply:
router.get<{name: string}>((ctx)=>{ctx.router.name;// again, no error});
If for some reason you want to be explicit about the type on a router context, use RouterContext instead of Context as it is also exported from the mod.ts.
The
params
field seems to be missing from theContext
type.See https://doc.deno.land/https/deno.land/x/oak/mod.ts#Context
Currently working around this by:
The text was updated successfully, but these errors were encountered: