-
Notifications
You must be signed in to change notification settings - Fork 148
How do I use generated database types? #150
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
Comments
Hi,
This should probably do the trick :) |
It would be a better DX if we can add this to the module configuration to be automatically used for every export default defineNuxtConfig({
// ...
supabase: {
types: "~/types/database"
}
} Just for this purpose, I also created a PR (#160) to make auto imports optional, so I can create my own composable which adds types and reexports the client. /composables/useSupaClient.ts import type { Database } from "~/types/database";
export default () => useSupabaseClient<Database>(); Currently, I have to use a different name, because auto imported composables overwrite the local composables with same name. Problem is, other developers may not know that there is a |
I agree that adding types in config will improve DX by a huge factor. I wouldn't want to keep importing the same types over and over again in components/composables. |
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
This issue was closed because it has been stalled for 30 days with no activity. |
I would like to use the types generated with the supabase cli. #90 was closed as completed so I'm assuming this is possible, but I can't seem to make it work.
I've generated the types of my database:
supabase gen types typescript --linked > supabase/schema.ts
And added the following to my
nuxt.config.ts
:The documentation references this for available options.
I expected type hints to show up as shown here.
The text was updated successfully, but these errors were encountered: