-
Notifications
You must be signed in to change notification settings - Fork 125
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
Make auto imports optional #160
Conversation
Makes it possible to have local composables with the same names as auto-imported ones. Otherwise, auto-imported composables overwrite locale ones. **/composables/useSupabaseClient.ts** ```ts import type { Database } from "~/types/database"; import { useSupabaseClient } from "nuxt-modules/supabase"; export default () => useSupabaseClient<Database>(); ```
👷 Deploy request for n3-supabase pending review.Visit the deploys page to approve it
|
If it's about overwriting composables, we have a priority field that we could use 🤔 I think it's how VueUse module for Nuxt does it to avoid overwriting user composables. |
For my use case, it is. Other developers may use it for other purposes too.
@atinux, is there a way currently to import and re-export |
Could you give me an example? Not sure to understand |
An example is from my first post. I would like to import /composables/useSupabaseClient.ts import type { Database } from "~/types/database";
import { useSupabaseClient } from "nuxt-modules/supabase";
export default () => useSupabaseClient<Database>(); Is there a way to accomplish this? |
I'm not sure making auto-import optional is the best DX to provide. But we could imagine a new config |
Cannot we support |
We can already do that but I think @ozum wants to avoid to do it each time he is calling the client and just do it once inside the composable itself. |
Exactly :) |
I don't know how easily doable it is. But the best DX could be to set the path of your types file in |
To be honest, I'm very new to Supabase and Nuxt module ecosystem. Currently, I'm struggling to develop a For example, I generate all types for |
If it helps I created a declare type Database = import('./supabase').Database; // my generated types live in `supabase.d.ts` and I just use the composable You could go a step further and create typed composables (differently named on purpose) that just return the supabase composable with the type already inferred i.e. |
@sduduzog, thanks for the suggestion. I am following a similar approach.
However, I want to use the same name, because other developers in the team forget to use my custom named composable and use the default one. I want to hide the typeless client completely. |
Makes it possible to have local composables with the same names as auto-imported ones. Otherwise, auto-imported composables overwrite locale ones.
Please see here why this can be useful.
/composables/useSupabaseClient.ts
Types of changes
Description
Checklist: