Skip to content
Discussion options

You must be logged in to vote

The change was mentioned as a breaking change in v10.0.0.

The error is accurate, in that 1 to 3 generic parameters are required. The first generic parameter is the route, which is then used to infer the route parameters. When the middleware is expressed in line, TypeScript can infer the route from the .get(), .all() etc. methods. In your case though, you need to supply it, because it cannot be inferred:

export const indexHandler = async (ctx: RouterContext<"/" | "/index">) => {
  //
}

That should resolve your issue.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@youngyou
Comment options

Answer selected by finlaydotb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #465 on February 06, 2022 09:17.