supabase-community / nuxt-supabase

A supa simple wrapper around Supabase.js to enable usage within Nuxt.
https://supabase.io
MIT License
167 stars 17 forks source link

TS2339: Property '$supabase' does not exist on type 'x'. - nuxt-property-decorator #11

Closed jannikbuscha closed 3 years ago

jannikbuscha commented 3 years ago

Bug report - TS2339: Property '$supabase' does not exist on type 'x'. - nuxt-property-decorator

Description

Hello, I already reported this error on the last pull request, it's still the error I get when I use the whole thing with the functions from nuxt-property-decorator:

image

The funny thing is that everything works though:

image

Here the complete code:

image

Also added a ts-shim.d.ts and types

image

image

Are there perhaps other ways I can set this up?

System information

jannikbuscha commented 3 years ago

Bug report - TS2339: Property '$supabase' does not exist on type 'x'. - nuxt-property-decorator

Description

Hello, I already reported this error on the last pull request, it's still the error I get when I use the whole thing with the functions from nuxt-property-decorator:

image

The funny thing is that everything works though:

image

Here the complete code:

image

Also added a ts-shim.d.ts and types

image

image

Are there perhaps other ways I can set this up?

System information

  • OS: Windows
  • Browser: Chromium
  • Version of supabase-js: ^2.0.0
  • Version of Node.js: v14.17.4.
  • Version of nuxt-property-decorator: ^2.9.1
  • IDE: PhpStorm 2021.2

If i use the asyncData method as given in the example i also get this error:

image

sduduzog commented 3 years ago

@scottrobertson I noticed that master is ahead of the latest release. The fix for this is actually there.

@jannikbuscha If you're still unsure about this, please install this module from github to try out the fix i.e. npm install supabase/nuxt-supabase and see that the typescript error message dissapears.

@scottrobertson This could be solved by a patch release I believe

scottrobertson commented 3 years ago

@scottrobertson I noticed that master is ahead of the latest release. The fix for this is actually there.

@jannikbuscha If you're still unsure about this, please install this module from github to try out the fix i.e. npm install supabase/nuxt-supabase and see that the typescript error message dissapears.

@scottrobertson This could be solved by a patch release I believe

Hey

Sorry, out this week.

@kiwicopple could you perhaps make @sduduzog a contributor so they can do releases here and the other repo?

@sduduzog once you have access, just bump the version number in package.json and then go to the draft release in GitHub and publish it.

sduduzog commented 3 years ago

It's worth mentioning @jannikbuscha

If you want to get this working in the meantime before the release, add this snippet to your projects types file

import { SupabaseClient } from '@supabase/supabase-js';

declare module 'vue/types/vue' {
interface Vue {
  $supabase: SupabaseClient;
}

or create a nuxt-supabase.d.ts file to the root of your project and add the snippet there i.e. image

and this should get you sorted until it's part of the release