Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v5.x DRAFT: fixed router types :) #227

Merged
merged 2 commits into from
Mar 25, 2024
Merged

v5.x DRAFT: fixed router types :) #227

merged 2 commits into from
Mar 25, 2024

Conversation

kwhitley
Copy link
Owner

Changes

Previously in v4.x, you were forced to either use a universal Request type at the router level, or override routes individually using generics, but not both.

const router = <FooRequest>Router()

router.get('/', (request) => { request.foo })

// would not work, due to the router-level generic
// THIS NOW WORKS IN v5.x :)
router.get<BarRequest>('/', (request) => { request.foo })

Now, we can use both simultaneously. A router-level generic for all routes within the router, and individual route-level generic overrides.

@kwhitley kwhitley merged commit 74f866e into v5.x Mar 25, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant