Closed th1m0 closed 2 months ago
Visit the deploys page to approve it
Name | Link |
---|---|
Latest commit | b756e00331b0ca4b8cc72c5d8c37ee083ac6dcc1 |
With this addition, is there a simple way to use the Database types generated by the Supabase CLI? https://supabase.com/docs/guides/api/rest/generating-types
With this addition, is there a simple way to use the Database types generated by the Supabase CLI? supabase.com/docs/guides/api/rest/generating-types
Yes you should no longer be needed to pass in the Database
types in the functions serverSupabaseClient
and serverSupabaseServiceRole
This should work fine:
import { serverSupabaseClient } from '#supabase/server'
export default defineEventHandler(async (event) => {
const client = await serverSupabaseClient(event)
})
client
should have the types generated by the supabase cli automatically if you set the types
path correctly in nuxt.config.ts
This was also done for the composables in https://github.com/nuxt-modules/supabase/pull/404
Thanks 🙏
client
should have the types generated by the supabase cli automatically if you set thetypes
path correctly innuxt.config.ts
@th1m0, the documentation states that the default path is "./types/database.types.ts," however, I had to specify it explicitly in nuxt.config.ts for it to work.
Thanks you both for the work <3
@Zebnastien Thanks for reaching out! That would be a bug, could you please raise an issue about this?
@th1m0 Done. Thanks!
Types of changes
Description
Added explicit type annotations for
serverSupabaseClient
andserverSupabaseServiceRole
as they lose theDatabase
type when building.