Skip to content

feat: re-export header types from fetchdts#1358

Open
LikiosSedo wants to merge 3 commits intoh3js:mainfrom
LikiosSedo:fix/export-typed-headers
Open

feat: re-export header types from fetchdts#1358
LikiosSedo wants to merge 3 commits intoh3js:mainfrom
LikiosSedo:fix/export-typed-headers

Conversation

@LikiosSedo
Copy link
Copy Markdown

@LikiosSedo LikiosSedo commented Mar 25, 2026

Summary

Re-export TypedHeaders, RequestHeaders, ResponseHeaders, RequestHeaderMap, and ResponseHeaderMap from fetchdts so consumers can type functions that accept h3 headers without importing fetchdts directly.

Currently TypedServerRequest is exported but the TypedHeaders type used by its headers property is not, making it awkward to write typed helper functions.

Also adds the RequestHeaders and ResponseHeaders exports mentioned in the migration guide ("TypedHeaders: Migrate to RequestHeaders and ResponseHeaders").

Closes #1308

Summary by CodeRabbit

  • New Features
    • Improved TypeScript support for HTTP headers by adding/exporting refined header-related types (TypedHeaders, RequestHeaders, ResponseHeaders, RequestHeaderMap, ResponseHeaderMap), enabling stronger typing and better developer experience when working with request/response headers.

Re-export TypedHeaders, RequestHeaders, ResponseHeaders,
RequestHeaderMap, and ResponseHeaderMap so consumers can type
functions that accept h3 headers without importing fetchdts directly.

Closes h3js#1308
@LikiosSedo LikiosSedo requested a review from pi0 as a code owner March 25, 2026 05:41
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 25, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b63a0da7-0caf-4f9b-9162-5e7daceaf336

📥 Commits

Reviewing files that changed from the base of the PR and between d3979d3 and 6b57430.

📒 Files selected for processing (2)
  • src/index.ts
  • src/types/handler.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/index.ts

📝 Walkthrough

Walkthrough

Updated TypeScript exports to expose five header-related types (TypedHeaders, RequestHeaders, ResponseHeaders, RequestHeaderMap, ResponseHeaderMap) by adding imports/re-exports in src/types/handler.ts and re-exporting them from src/index.ts. No runtime logic changed.

Changes

Cohort / File(s) Summary
Type re-exports — public entry
src/index.ts
Added type re-exports: TypedHeaders, RequestHeaders, ResponseHeaders, RequestHeaderMap, ResponseHeaderMap.
Type imports & re-exports — internal types
src/types/handler.ts
Imported and re-exported the five header-related types from upstream (fetchdts): TypedHeaders, RequestHeaders, ResponseHeaders, RequestHeaderMap, ResponseHeaderMap.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I hopped through types to spread the cheer,
Five header friends now living here,
Quietly added, no code to spar—
A little export, a tiny star ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: re-export header types from fetchdts' clearly and accurately summarizes the main change of re-exporting five header-related types to improve API usability.
Linked Issues check ✅ Passed The PR successfully addresses issue #1308 by re-exporting TypedHeaders, RequestHeaders, ResponseHeaders, RequestHeaderMap, and ResponseHeaderMap, enabling consumers to type functions handling h3 headers without direct fetchdts dependency.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the stated objective of re-exporting header types; no unrelated modifications or out-of-scope changes are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

…fetchdts re-export

Avoids build issues since fetchdts is a devDependency — the build
tool (obuild) inlines types referenced through h3's own modules
but may not handle direct re-exports from external packages.
Import TypedHeaders, RequestHeaders, ResponseHeaders, RequestHeaderMap,
and ResponseHeaderMap from fetchdts and re-export them so the build
tool can inline them properly.
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.

[v2] Reexport TypedHeaders from fetchdts

1 participant