fix(GRO-213): fix ContentfulStatusCode type error in setup.ts
Cast (result.code ?? 500) to ContentfulStatusCode after importing the type from hono. This satisfies the TypeScript overload without using broad 'as number' cast. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
committed by
Flea Flicker
parent
21df02eef8
commit
2ccd42736a
@@ -1,4 +1,4 @@
|
|||||||
import { Hono } from "hono";
|
import { Hono, type ContentfulStatusCode } from "hono";
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { z } from "zod/v3";
|
import { z } from "zod/v3";
|
||||||
import { eq, getDb, staff, businessSettings } from "@groombook/db";
|
import { eq, getDb, staff, businessSettings } from "@groombook/db";
|
||||||
@@ -70,7 +70,7 @@ setupRouter.post("/", zValidator("json", setupSchema), async (c) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if ("error" in result) {
|
if ("error" in result) {
|
||||||
return c.json({ error: result.error }, result.code as number);
|
return c.json({ error: result.error }, (result.code ?? 500) as ContentfulStatusCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.json({ ok: true, staff: result.staff }, 201);
|
return c.json({ ok: true, staff: result.staff }, 201);
|
||||||
|
|||||||
Reference in New Issue
Block a user