H
Hono4w ago
Arseniy

Type 'never' has no call signatures. When using client with '$get'

I noticed this type error only happen when i use get or post without body. In all other cases my api client works properly. Any idea how to solve it? Here how my route looks like:
export const getSource = new OpenAPIHono<{
Variables: ContextVariables;
}>().openapi(
createRoute({
method: "get",
path: "/",
tags: ["Sources"],
summary: "Get user's database source",
responses: {
200: {
description: "Source retrieved successfully",
content: {
"application/json": {
schema: getSourceSchema.openapi("GetSource"),
},
},
},
404: {
description: "No source found",
},
},
}),
async (c) => {
const db = c.get("db");
const user = c.get("user");
export const getSource = new OpenAPIHono<{
Variables: ContextVariables;
}>().openapi(
createRoute({
method: "get",
path: "/",
tags: ["Sources"],
summary: "Get user's database source",
responses: {
200: {
description: "Source retrieved successfully",
content: {
"application/json": {
schema: getSourceSchema.openapi("GetSource"),
},
},
},
404: {
description: "No source found",
},
},
}),
async (c) => {
const db = c.get("db");
const user = c.get("user");
here how I create client:
import { clientEnvs } from "@/env/client";
import { type AppType } from "@/server";
import { hc } from "hono/client";

export const client = hc<AppType>(clientEnvs.NEXT_PUBLIC_DOMAIN, {
init: {
credentials: "include",
},
});
import { clientEnvs } from "@/env/client";
import { type AppType } from "@/server";
import { hc } from "hono/client";

export const client = hc<AppType>(clientEnvs.NEXT_PUBLIC_DOMAIN, {
init: {
credentials: "include",
},
});
No description
1 Reply
Arseniy
ArseniyOP4w ago
Never mind, its seems solved when i upgraded @hono/zod-openapi to 1.1.0 version

Did you find this page helpful?