Skip to content

chore: update typescript to v6#4824

Open
Moshyfawn wants to merge 1 commit intohonojs:mainfrom
Moshyfawn:chore/typescript-6
Open

chore: update typescript to v6#4824
Moshyfawn wants to merge 1 commit intohonojs:mainfrom
Moshyfawn:chore/typescript-6

Conversation

@Moshyfawn
Copy link
Copy Markdown

This PR updates TypeScript to v6 and adjusts config for the new defaults.

  • Add explicit types fields (v6 defaults to types: [])
  • Constrain BufferSource type to ArrayBuffer
  • Drop esModuleInterop true by default

Note

TS v6 benchmarks ran a bit slower, which is expected - v6 is mostly a preparations release with stricter checks ahead of v7.

Benchmarks using tsgo and today's TS v7 release show roughly 2× lower memory usage and almost 3× faster type-checking on Mac M3.

TS 7.0 readiness

  • tsc --stableTypeOrdering --noEmit - passes with no issues
  • tsgo --noEmit with TS 7.0.0-dev.20260324.1 - passes with no issues (full type-check with the native Go compiler)
  • tsgo -p tsconfig.build.json - passes with no issues (successfully generates d.ts files)
  • tsgo --build - 4 errors in tests code regarding overload resolution

The author should do the following, if applicable

  • Add tests
  • Run tests
  • bun run format:fix && bun run lint:fix to format the code
  • Add TSDoc/JSDoc to document the code

- Add explicit types fields (v6 defaults to types: [])
- Constrain BufferSource type to ArrayBuffer for ES2024
- Drop esModuleInterop true by default
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.84%. Comparing base (e1ae0eb) to head (0468a7c).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4824   +/-   ##
=======================================
  Coverage   92.84%   92.84%           
=======================================
  Files         177      177           
  Lines       11643    11643           
  Branches     3469     3469           
=======================================
  Hits        10810    10810           
  Misses        832      832           
  Partials        1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown

@travisbreaks travisbreaks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TypeScript major version bumps in framework code need careful review. A few things:

  1. BufferSource narrowing to ArrayBuffer: This is the most impactful change. Downstream consumers passing TypedArray or DataView to Hono APIs that accept BufferSource will break at the type level. Worth checking if any middleware or common patterns rely on passing Uint8Array directly (common in Workers/crypto code).

  2. esModuleInterop removal: If downstream projects importing Hono have esModuleInterop enabled in their tsconfig (which many do as a default), this should be fine. But if Hono's own code relied on esModuleInterop for default imports from CJS modules, those imports would need to change to namespace imports. Worth verifying no CJS dependencies are imported with default-import syntax.

  3. TS7 pre-testing: Thorough approach testing against tsgo. The 4 build errors in tests: are these known tsgo gaps or real issues that TS7 would surface?

  4. Peer dependency range: Will the package.json typescript peer dep be updated to include v6? Users on v5 shouldn't be forced to upgrade until they're ready.

Good migration work. The author's diligence on pre-testing TS7 is noted.

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.

2 participants