v4.12.13 — Type fixes, trailing-slash skip, cache callback
Key Points
- Type inference fixed for app.on handlers
- trailing-slash middleware gains skip option
- cache adds onCacheNotAvailable callback
Summary
This release (v4.12.13) includes a TypeScript typing fix for handler response inference and two new feature additions: a skip option for the trailing-slash middleware and an onCacheNotAvailable callback for caching behavior. No breaking changes are indicated.
Key Points
- fix(types): Type inference for
app.onnow derives the response type from the last handler in the 9-/10-handler overloads.- If you depend on accurate response typings from long handler-chains, you should see improved inference; adjust any manual generics if you previously worked around the issue.
- feat(trailing-slash): Added a
skipoption to the trailing-slash middleware.- Use
skipto conditionally bypass trailing-slash handling for specific requests, e.g.trailingSlash({ skip: req => req.url.startsWith('/api') }).
- Use
- feat(cache): Added
onCacheNotAvailableoption.- Provide a callback to handle cases where the cache is unavailable:
cache({ onCacheNotAvailable: (req, ctx) => { /* fallback logic */ } }).
- Provide a callback to handle cases where the cache is unavailable:
Upgrade Notes
- These are additive and intended to be backward compatible. Verify TypeScript typings in code paths that rely on long handler overloads and remove any prior manual workarounds if they are now redundant.
Contributors
- yusukebe (release author)
- T4ko0522 (first-time contributor)