Fix bun-types resolution; fix possibly-undefined health-check row
Same bun-types-vs-@types/bun fix as continuum-common. Also fixes a real noUncheckedIndexedAccess violation in the /health route: db.execute()'s result is T[], so rows[0] is 'T | undefined', not T — destructuring assumed it always existed. Verified with a clean 'bunx tsc --noEmit'.
This commit is contained in:
+2
-2
@@ -14,9 +14,9 @@ const app = new Elysia()
|
||||
.use(cors())
|
||||
.use(swagger({ path: "/docs" }))
|
||||
.get("/health", async () => {
|
||||
const [{ ok }] = await db.execute<{ ok: number }>(sql`select 1 as ok`);
|
||||
const rows = await db.execute<{ ok: number }>(sql`select 1 as ok`);
|
||||
const redisPing = await redis.ping();
|
||||
return { status: "ok", db: ok === 1, redis: redisPing === "PONG" };
|
||||
return { status: "ok", db: rows[0]?.ok === 1, redis: redisPing === "PONG" };
|
||||
})
|
||||
.use(authRoutes)
|
||||
.use(farmRoutes)
|
||||
|
||||
Reference in New Issue
Block a user