Skip to content

fix: default Database generic to any, matching createClient() - #156

Open
mandarini wants to merge 1 commit into
mainfrom
fix/database-generic-default-any
Open

fix: default Database generic to any, matching createClient()#156
mandarini wants to merge 1 commit into
mainfrom
fix/database-generic-default-any

Conversation

@mandarini

@mandarini mandarini commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Defaults the Database generic to any instead of unknown across every client-creating function (withSupabase, withSupabaseClient, withSupabaseAdminClient, createSupabaseContext, createContextClient, createAdminClient, and both the Hono and Elysia adapters), plus SupabaseContext itself. Previously an unannotated write failed type-checking, for example ctx.supabase.from('t').insert({...}) resolved to not assignable to parameter of type 'never', forcing every untyped consumer into a withSupabase<any>(...) workaround just to compile.

This matches createClient() in @supabase/supabase-js, which has always defaulted its own Database generic to any. Nobody loses type safety who wants it: pass generated database types the same way as before, withSupabase<Database>(...), and every table and RPC call stays fully typed. Only the unannotated path changes, from a compile error to a permissive default.

The any default is centralized in one named alias, UntypedDatabase, in types.ts, rather than repeated as a bare any at each call site. Docs (typescript-generics.md, api-reference.md, adapters/nestjs.md) are updated to match.

@mandarini
mandarini requested review from a team as code owners September 11, 2026 15:38
@pkg-pr-new

pkg-pr-new Bot commented Sep 11, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@supabase/server@156

commit: 8f19dfa

@mandarini mandarini self-assigned this Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants