-
Hello, I'm new to Hono and I was wondering if there's a way to set a response schema to c.json() or to set a global schema for all json responses I found out I could use interface CustomResponse {
success: boolean;
message: string;
}
return c.json<CustomResponse, 400>({ success: false, message: "error" }, 400); I don't mind typing the interface every time but retyping the status code doesn't seem a good idea, and if I removed status code from the generic TypeScript throws an error, and if I removed it from the parameters it just returns the default 200. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi @kofta999 Unfortunately, we don't have a public API to specify response Types explicitly, so there is nothing to do about your question. |
Beta Was this translation helpful? Give feedback.
Hi @kofta999
Unfortunately, we don't have a public API to specify response Types explicitly, so there is nothing to do about your question.