Skip to content

Conversation

@miyaji255
Copy link
Contributor

@miyaji255 miyaji255 commented Oct 31, 2025

Summary

This pull request enhances the type safety and expressiveness of the client-side URL generation in the Hono framework. The main improvement is the introduction of a new TypedURL type, which allows the client to generate URLs with strongly-typed protocol, host, port, path, and query parameters based on the application's route schema and the provided base URL. Several generics and utility types are introduced to propagate this type information throughout the client, ensuring that URL generation is accurate and type-checked at compile time.

esbuild v0.15.18 doesn't support const type parameters, so I updated esbuild.

Motivation

I wanted to add types so that keys used with SWR would be easy to reuse in other parts of the codebase. However, $url did not preserve that type information, so I created this PR.

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

@codecov
Copy link

codecov bot commented Oct 31, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.29%. Comparing base (3a550d2) to head (d1ace9d).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4502   +/-   ##
=======================================
  Coverage   91.29%   91.29%           
=======================================
  Files         173      173           
  Lines       11178    11178           
  Branches     3224     3224           
=======================================
  Hits        10205    10205           
  Misses        972      972           
  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.

@yusukebe
Copy link
Member

yusukebe commented Nov 1, 2025

Hi @miyaji255

This is super interesting. I'll look at it deeply later.

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