-
-
Notifications
You must be signed in to change notification settings - Fork 998
Open
Labels
enhancementNew feature or request.New feature or request.
Description
What version of Hono are you using?
4.12.2
Reproduction
import { Hono } from "hono";
import { hc } from "hono/client";
const app = new Hono().get("/", (c) =>
Promise.resolve({ hello: "world" }).then((d) => c.json(d)),
);
const api = hc<typeof app>("");
// data has unknown type
const data = await api.index.$get().then((r) => r.json());But the same code without arrow funcion works:
import { Hono } from "hono";
import { hc } from "hono/client";
const app = new Hono().get("/", (c) => {
const resp = Promise.resolve({ hello: "world" }).then((d) => c.json(d));
return resp;
});
const api = hc<typeof app>("");
// data has { hello: string; } type
const data = await api.index.$get().then((r) => r.json());What is the expected behavior?
Types should be inferred in both cases
What do you see instead?
RPC json response has unknown type
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request.New feature or request.