Skip to content
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

Export GenericSchema types #1005

Closed
wants to merge 1 commit into from

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
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