How to fix $supabase does not exist on type in NUXTJS
-
I'm getting this error when i access my $supabase nuxt plugin in pages/index.vue
~/plugins/supabase.js
import {createClient} from '@supabase/supabase-js' export default ({ app },inject) => { const supabaseUrl = app.$config.supabaseUrl const supabaseKey = app.$config.supabaseApi const supabase = createClient(supabaseUrl, supabaseKey) inject('supabase', supabase) }
i loaded plugin in nuxt config
plugins: [ {src: '~/plugins/supabase.js', mode : 'client'} ],
Anyone can help to fix this issue, i use typescript with nuxtjs
-
You have to define a type.
example :
data(){ return { $supabase :(this as any).$supabase, } },
-
@nubelle Thanks man it works