HonoH
Honoโ€ข10mo ago
Agustรญn

Unsafe call of an `error` type typed value

Hi Hono team! ๐Ÿ‘‹

I'm trying to align a route definition with the generated $get method type, but I'm running into a mismatch and would appreciate your help.

This is the content of the type:
(property) $get: (args: {
    param: {
        username: string;
    };
}, options?: ClientRequestOptions) => Promise<ClientResponse<{
    _id: string;
    username?: string | undefined;
    name?: string | undefined;
    picture?: string | undefined;
    banner?: string | undefined;
}, 200, "json">>


Ant this it's my endpoint defined:
const PATH = "/users";
const TAGS = ["Users"];

export const listUser = createRoute({
  tags: TAGS,
  method: "get",
  path: `${PATH}/:username`,
  request: {
    params: z.object({
      username: z.string(),
    }),
  },
  responses: {
    200: schema(zListUserResultSchema, "User found"),
  },
});
image.png
Was this page helpful?