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

Open
wants to merge 1 commit into
base: master
Choose a base branch
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.

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.

None yet

1 participant