types: restore Supabase row typing, fix parseInput inference (586→76 tsc errors)

The installed supabase-js (2.99, 5 generics) is incompatible with
@supabase/[email protected] (calls it with 3), collapsing the server client's
schema to `never` — the root cause of ~450 of the 586 hidden type errors
(next.config typescript.ignoreBuildErrors masks them all).

- lib/supabase/server.ts: annotate the factory as SupabaseClient<Database>
  and bridge the ssr/js impedance mismatch at the one documented boundary;
  type the setAll cookie params.
- lib/supabase/proxy.ts, proxy.ts: type the setAll cookie params.
- lib/auth-helpers.ts: parseInput now infers its result from the schema via
  z.infer (was a fragile ZodSchema<T> that widened outputs to {}).
- lib/validations.ts: annotate flexibleDateTime's output type.
- types/database.ts: add class_signup_tx / class_cancel_tx RPC signatures
  (called but absent; pending full regeneration).
- tsconfig.json: target ES2020 (door-log-logic uses BigInt literals).
- vitest.setup.ts: import beforeAll/afterAll instead of relying on globals.

No runtime behavior change; 639 tests still green. ignoreBuildErrors stays
on until the remaining errors reach zero.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This commit is contained in:
Moheeb Zara
2026-08-01 18:40:33 -07:00
co-authored by Claude Opus 4.8
parent 9ac0c2486c
commit 1766780bca
10 changed files with 281 additions and 16 deletions
+2 -3
View File
@@ -124,13 +124,12 @@ export async function joinSpace(formData: {
// Try the new multi-code invites table first. Falls back to the legacy
// spaces.invite_code (a permanent default) if the code isn't found there.
let invite: { id: string; space_id: string; max_uses: number | null; uses_count: number; expires_at: string | null; is_enabled: boolean; role: string } | null = null
const { data: inviteRow } = await admin
.from('space_invites')
.select('id, space_id, max_uses, uses_count, expires_at, is_enabled, role')
.eq('code', code)
.maybeSingle()
if (inviteRow) invite = inviteRow as typeof invite
const invite = inviteRow
let spaceId: string | null = null
if (invite) {
@@ -171,7 +170,7 @@ export async function joinSpace(formData: {
.from('space_members')
.select('id')
.eq('user_id', user.id)
.in('status', ACTIVE_STATUSES as unknown as string[])
.in('status', ACTIVE_STATUSES)
.maybeSingle()
if (existingMembership) {
return { error: 'You are already a member of a space.' }