types: clear remaining tsc errors across 41 files (76→14, behavior-preserving)

Per-file type-only fixes surfaced after the Supabase client was correctly
typed. All fixes preserve runtime behavior; no any/ts-ignore/ts-expect-error.

- lib/supabase/client.ts: annotate the browser client as SupabaseClient<Database>
  (same ssr/js drift as server.ts; fixes it centrally for all callers).
- Supabase embedded-select joins whose FK metadata is missing from the
  generated types are bridged with `as unknown as <target>` + a TODO to remove
  after regenerating types/database.ts.
- setState optimistic-update variance and raw <select> enum values cast to the
  precise element/union type; .insert payload fields (Json, enums) given the
  precise column type via satisfies/field casts.
- Added narrowing guards where a value was legitimately nullable (comms channel,
  public form page) without changing the intended path.

The 14 remaining errors are confined to the four files fixed in Phase B (real
bugs + the tautological actions.test rewrite). 639 tests still green.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This commit is contained in:
Moheeb Zara
2026-08-01 18:56:11 -07:00
co-authored by Claude Opus 4.8
parent 1766780bca
commit b1edb5c460
41 changed files with 148 additions and 59 deletions
+5 -3
View File
@@ -98,10 +98,12 @@ export default async function MePage() {
}))
const signupRes = await getMyClassSignups()
const classSignups: ClassSignup[] = 'data' in signupRes ? (signupRes.data as ClassSignup[]) : []
// TODO(types): remove after regenerating types/database.ts (missing FK relationship metadata)
const classSignups: ClassSignup[] = 'data' in signupRes ? (signupRes.data as unknown as ClassSignup[]) : []
const reservationRes = await getMyReservations()
const reservations: Reservation[] = 'data' in reservationRes ? (reservationRes.data as Reservation[]) : []
// TODO(types): remove after regenerating types/database.ts (missing FK relationship metadata)
const reservations: Reservation[] = 'data' in reservationRes ? (reservationRes.data as unknown as Reservation[]) : []
const cardsRes = await getMyCards()
const myCards: MyCard[] = 'data' in cardsRes ? (cardsRes.data as MyCard[]) : []
@@ -121,7 +123,7 @@ export default async function MePage() {
const notifsRes = await getMyNotifications()
const notifs: MyNotif[] = 'data' in notifsRes ? (notifsRes.data as MyNotif[]) : []
const unreadNotifs = 'unreadCount' in notifsRes ? notifsRes.unreadCount : 0
const unreadNotifs = 'unreadCount' in notifsRes ? (notifsRes.unreadCount ?? 0) : 0
const notifPrefsRes = await getMyNotificationPreferences()
const notifPrefs: PrefMap = 'data' in notifPrefsRes ? notifPrefsRes.data : {}