Repository navigation
Replies: 3 comments 1 reply
|
I'm just learning too. Is it just |
0 replies
|
For anyone still finding an answer: |
1 reply
|
The requirement I had when I tried to use RouterContext was getting access to route parameters. Since I found a different way to get access to route parameters and the RouterContext API is quite uncomfortable to be honest I opted for not using RouterContext at all. This is what I ended up with. import { Context, helpers } from '@oak/oak';
function testHandler(ctx: Context) {
const params = helpers.getQuery(ctx, { mergeParams: true });
console.debug(params);
ctx.response.body = `Path parameter was '${params.myparam}'`;
}See the docs for more |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hello,
Consider the following code
When run with
deno run --allow-net test.tsand accessed withcurl localhost:3000/test/asdwill respond withPath parameter was 'asd'as expected.But when you type check that with
deno run --allow-net --check test.tsor simply open it with vsode and the deno extension, it throws the following:error: TS2707 [ERROR]: Generic type 'RouterContext<R, P, S>' requires between 1 and 3 type arguments.What would be the right type definition for
ctxin thetestHandlerfunction to make Typescript happy?.Thanks.
All reactions