Skip to content

Conversation

@aantthony
Copy link
Contributor

I think this fixes #4427

Example test code:

import { createFactory } from 'hono/factory';
const factory = createFactory();
export const handlers = factory.createHandlers(c =>
	c.json({ ok: true }),
);

With the type exported (since v4.9.8), I was getting the error:

ts(2742): The inferred type of 'handlers' cannot be named without a reference to '../node_modules/hono/dist/types/context.js'. This is likely not portable. A type annotation is necessary.

By avoiding the export, there is no type error. Removing this export should not create any issues as far as I know, because it is not imported anywhere or publicly exposed outside hono itself.

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

@codecov
Copy link

codecov bot commented Sep 28, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.25%. Comparing base (16eb882) to head (d3f14df).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4433   +/-   ##
=======================================
  Coverage   91.25%   91.25%           
=======================================
  Files         171      171           
  Lines       10915    10915           
  Branches     3146     3146           
=======================================
  Hits         9961     9961           
  Misses        953      953           
  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.

@BarryThePenguin
Copy link
Contributor

Whoops.. looks like I inadvertently changed that in #4406

Looks good 👍🏻

@yusukebe yusukebe changed the title Fix #4427 type regression by removing non-public export fix(context): Fix #4427 type regression by removing non-public export Sep 29, 2025
Copy link
Member

@yusukebe yusukebe left a comment

Choose a reason for hiding this comment

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

LGTM!

@yusukebe
Copy link
Member

@aantthony

Thank you!

@yusukebe yusukebe merged commit e3bf8c8 into honojs:main Sep 29, 2025
20 checks passed
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.

regression in Context/c.json() type inference in v4.9.8

3 participants