Repository navigation
Conversation
🦋 Changeset detectedLatest commit: 9c50941 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughKoa and Hono wrapper return types now expose the existing Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to
|
Summary
Both
koaWrapper()andhonoWrapper()attach the underlying middleware to the returned function at runtime, but the published declarations omit that property. TypeScript consumers cannot callwrapper.devMiddleware.waitUntilValid(),invalidate(), orclose()without an assertion. This surfaced while migrating Strapi's webpack adapter tokoaWrapper().Expose the existing
devMiddlewareproperty in both wrapper return types by updating the JSDoc source and regenerating declarations. The callable intersection preserves the middleware API and its custom request/response generics. Include a patch changeset.What kind of change does this PR introduce?
A TypeScript declaration bug fix. Runtime behavior is unchanged.
Did you add tests for your changes?
Yes. A consumer fixture is compiled through Jest under strict TypeScript settings. It covers both wrappers, middleware lifecycle methods, custom request/response types, and negative checks that prevent the API from degrading to
any. The fixture fails against the original declarations and passes with this change.Validation on Node 26.8.1:
npm run build:typesnpm run lintnpm run test:only -- --runInBand test/wrapper-types.test.jstypes/unchanged.--testNamePattern; 6,647 other cases skipped).The full runtime coverage run was interrupted after 18 minutes without a completed result, so it is not reported as passing.
Additional browser validation:
npm run test:e2ereports 226 passed and 7 failed across 17 suites. The two indicator failures reproduce on untouched upstream commit0ffba03. Five CORS cases time out navigating to127.0.0.2; the first of those also reproduces on the untouched upstream commit. The declaration fix makes no runtime changes.Does this PR introduce a breaking change?
No. It makes the declarations reflect properties already available at runtime.
If relevant, what needs to be documented once your changes are merged or what have you already documented?
The changeset describes the corrected return types. No new runtime API is introduced.
Use of AI
Codex assisted with source inspection, the declaration change, regression tests, and local validation. The consumer fixture was tested against both the original and corrected declarations; unrelated browser failures were checked against untouched upstream code.
Summary by CodeRabbit
Improvements
devMiddlewareAPI on returned handlers.Tests