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

Feature Request: Add Database Type Support for Fastify Supabase Client #35

Open
ollebergkvist opened this issue Aug 24, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@ollebergkvist
Copy link

Is your feature request related to a problem? Please describe.
Currently, when using the fastifySupabase plugin, it's not possible to provide a specific Database type to the Supabase client during initialization. As a result, developers need to manually define the Database type throughout their codebase to take advantage of TypeScript's type inference, which adds unnecessary redundancy and increases the potential for errors.

Describe the solution you'd like
I would like to have the ability to supply the Database type directly during the initialization of the fastifySupabase plugin. This would allow the type to be inferred automatically across the application, reducing the need to manually specify the Database type in multiple places.

@ollebergkvist ollebergkvist added the enhancement New feature or request label Aug 24, 2024
@vehm
Copy link

vehm commented Jan 6, 2025

Just jumping in here, but you can accomplish this by re-declaring the client declaration merging wherever you're registering the plugin with the Database type:

declare module "fastify" {
	interface FastifyInstance {
		supabaseClient: SupabaseClient<Database>;
	}
	interface FastifyRequest {
		supabaseClient: SupabaseClient<Database>;
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants