Skip to content

Commit

Permalink
modified changelog and Router types
Browse files Browse the repository at this point in the history
  • Loading branch information
kwhitley committed Dec 15, 2023
1 parent 2559423 commit 9539603
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- added: `CorsOptions` now exported from `createCors`
- added: `flow(router)` to reduce initilization boilerplate
- fixed: `createCors()` now correctly defaults to all methods "*" unless specified, not just GET
- added: router generics have now been overhauled to allow greater flexibility (may use router-level and route-level together)
- **v4.0.00** - Partial changelog below
- BREAKING: heavy TS rewrite for core Router (thank you, ChatGPT)
- added: nearly all extras from itty-router-extras
Expand Down
8 changes: 3 additions & 5 deletions example/universal-vs-overrides.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ const universalRouter =
})
.get<IRequestStrict>('/type-check', (request, env) => {
request.foo // should NOT be found
env.KB // should NOT be found *******
env.KV // should be found *******
env.KV // should be found
env.KB // should NOT be found
})
.puppy('/type-check', (request, env) => {
request.foo // should be found
Expand All @@ -36,6 +36,7 @@ const universalRouter =
env.KB // should NOT be found
})

// Router without generics will use IRequest by default
const overrideRouter =
Router()
.get('/type-check', (request, env, ctx) => {
Expand All @@ -47,6 +48,3 @@ const overrideRouter =
request.foo // should NOT be found
ctx.waitUntil // should infer
})
.puppy()

universalRouter.handle({ method: 'GET', url: '' }, {})

0 comments on commit 9539603

Please sign in to comment.