Describe the solution you'd like
The ability to pass in database types to the Supabase client, as shown in the docs here: https://supabase.com/docs/reference/javascript/typescript-support
Example of how it might be used:
import { Database } from 'lib/database.types.ts'
const client = useSupabaseClient<Database>()
const { data: book } = await client
.from('books') // TypeScript is aware of all the table names.
.select()
.eq('id', id)
.single();
const { title, author, publish_date, created_at, updated_at } = book // TypeScript is aware of all columns for that table.
Describe alternatives you've considered
It seems to work for the composables if I change the "useSupabaseClient" signature to <T>(): SupabaseClient<T> and use the type further down like this:
if (!nuxtApp._supabaseClient || recreateClient) {
nuxtApp._supabaseClient = createClient<T>(url, key, options)
}
I'm not sure how to handle setting the types when the "supabase.client.ts" and "supabase.server.ts" plugins load, though.
Describe the solution you'd like
The ability to pass in database types to the Supabase client, as shown in the docs here: https://supabase.com/docs/reference/javascript/typescript-support
Example of how it might be used:
Describe alternatives you've considered
It seems to work for the composables if I change the "useSupabaseClient" signature to
<T>(): SupabaseClient<T>and use the type further down like this:I'm not sure how to handle setting the types when the "supabase.client.ts" and "supabase.server.ts" plugins load, though.