fix(deprecated): correct v1 signatures in the compat shim#1492
Conversation
`appendResponseHeaders`/`appendHeaders` declared `headers: string` while the body iterates it with `Object.entries`, so the exports were uncallable as typed. `sendRedirect` required `code` even though v1 defaulted to 302 and the delegated `redirect()` still does. Both now match their sibling exports (`setResponseHeaders`/`setHeaders`, `sendNoContent`).
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughDeprecated redirect and response-header signatures were updated in ChangesDeprecated API signature updates
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Thanks for the quick review and merge! I'll pick up more items from #1482. |
Addresses two of the deprecated-typing items from #1482.
appendResponseHeaders(and itsappendHeadersalias) declaresheaders: string, but the body iterates the argument withObject.entries. As typed the export is unusable: passing the record it actually wants is a type error, and passing the declaredstringyields index-keyed garbage headers. Its siblingsetResponseHeaders/setHeadersalready takesRecord<string, string>, so this brings the append pair in line with it.sendRedirectrequiredcode, but v1 defaulted to 302 and the delegatedredirect()still hasstatus = 302.sendNoContentdirectly above it already declarescode?: number, so the two are consistent again.Both changes are type-only — runtime behaviour is untouched and there is no bundle impact.
Type tests are added to
test/unit/types.test-d.ts. They fail onmain(TS2345on the record argument, twice, andTS2554for the missingcode) and pass with the change. Locallyvitest --runreports 55 files / 1561 passed withType Errors no errors, andoxlintplusoxfmt --checkare clean.Summary by CodeRabbit