Typesafe middleware route matcher #62415
Enriquefft
started this conversation in
Ideas
Replies: 0 comments
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.
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
as const
within middleware config to reuse the matcher information.asserts
keyword.Background
NextJs is TypeScript-first, which is what makes it so good, but this small feature can be an easily solvable source of errors when explicitlyf defining the route matcher.
Proposal
I'm aware there is a good reason for some typescript keywords to not be available withtin NextJs config, so as an alternative it could be possible to extend the typedRoutes experimental config so that it also applies in the route matcher.
Beta Was this translation helpful? Give feedback.
All reactions