Skip to content

fix(types): use supabase-js CreateClientHelper #119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

avallete
Copy link
Member

Re-using the types from supabase-js the way we do can cause issue when supabase-js upgrade as peer-dependency. Since mismatch can occurs between how supabase-js declare his types and how they're used in this repo.

Since it's a duplication of the createClient with additionals and stricter options, this is a draft to attempt to reduce this duplication and have this more driven by supabase-js repo. So when updates are needed, everything in ssr type-wise adapt transparently.

This will require first: supabase/supabase-js#1491 to pass on.

Once it's done, the idea is to re-use the CreateClientHelper and GenericSupabaseClient instead of hard-coded definition we'll re-use. Then it's up to supabase-js to provide consistent exports for those types to make them compatible with the underlying postgrest-js types if changes occurs.

While this provide the benefits of reducing code duplication across our repos, this also have two drawbacks:

  1. Some of the logic leak to supabase-js (now has to take into account additional options)
  2. Couldn't find a way to keep the multi-functions (with deprecation warning) declaration with this approach. Since I use variables definitions instead.

It also introduce some basics smoke tests over the types expected from both createServerClient and createBrowserClient

BREAKING CHANGES: will not work with previous version of supabase-js where the helper wasn't defined

avallete added 2 commits July 10, 2025 23:26
BREAKING CHANGES: will not work with previous version of supabase-js where the helper wasn't defined
@avallete avallete changed the title fix(types): use supabase-js helper script to reduce duplication fix(types): use supabase-js CreateClientHelper Jul 11, 2025
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.

1 participant