Skip to content

Conversation

@alexdlm
Copy link

@alexdlm alexdlm commented Apr 1, 2024

What kind of change does this PR introduce?

Improvement

What is the current behavior?

Database / Schema types can be supplied / inferred.

What is the new behavior?

Able to extend/reuse the types for schema interfaces.

Additional context

It's not strictly necessary but I think is friendlier to export all the named types that are referenced in exported types.

I'm making a library that expects a table with a specific schema to be defined, it's nicer to be able to require the SupabaseClient that a user passes through has the table with the expected schema defined, plus all usage of the client conforms to the declared interfaces. Also declaring my schema as extends GenericSchema catches issues from future type changes in the right place, and also documents to consumers what the schema/database objects are.

It's also nicer for future breaks in the interfaces to cause errors in the types that use them instead of in function calls spread around.

@soedirgo
Copy link
Member

Thanks for the PR! Unfortunately these are internal types and we don't plan to export them.

You can of course reimplement these types in your library, and things should keep working since the shape of the Database type is expected to be backward-compatible as we make changes to it - this way you won't have unexpected changes to the types when you upgrade supabase-js (e.g. we may decide to throw away all these helper types when we do a major refactor).

@soedirgo soedirgo closed this Oct 28, 2024
mandarini pushed a commit that referenced this pull request Oct 2, 2025
🤖 I have created a release *beep* *boop*
---


##
[2.67.3](supabase/auth-js@v2.67.2...v2.67.3)
(2024-12-17)


### Bug Fixes

* return redirect errors early
([#1003](supabase/auth-js#1003))
([f9775cf](supabase/auth-js@f9775cf))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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