What version of Hono are you using?
4.4.9
What runtime/platform is your app running on?
Bun
What steps can reproduce the bug?
// index.ts
import { Hono } from "hono";
import { logger } from "hono/logger";
import { createFactory } from "hono/factory";
const factory = createFactory();
const myMiddleware = () => {
return factory.createMiddleware(async (c, next) => {
const random = Math.random();
if (random > 0.5) {
c.status(500);
return c.text("Probabilistic error", 500);
}
return next();
});
};
const app = new Hono().use(logger()).get("/", myMiddleware(), async (c) => {
return c.json({ message: "Hello, World!" }, 200);
});
export default app;
// index.test.ts
import { test, expect } from "bun:test";
import app from ".";
import { testClient } from "hono/testing";
test("GET /", async () => {
const res = await testClient(app).index.$get();
expect(res.status).toBe(500); // <- "Argument of type '500' is not assignable to parameter of type '200'"
});
What is the expected behavior?
Consider other status codes that may be returned from middlewares or other factors.
What do you see instead?
Argument of type '500' is not assignable to parameter of type '200'
Additional information
No response
What version of Hono are you using?
4.4.9
What runtime/platform is your app running on?
Bun
What steps can reproduce the bug?
What is the expected behavior?
Consider other status codes that may be returned from middlewares or other factors.
What do you see instead?
Argument of type '500' is not assignable to parameter of type '200'Additional information
No response