diff --git a/package.json b/package.json index c639bd92..04b8b2df 100755 --- a/package.json +++ b/package.json @@ -10,7 +10,8 @@ } ], "files": [ - "lib" + "lib", + "types" ], "main": "lib/module.js", "scripts": { diff --git a/types/index.d.ts b/types/index.d.ts index c99ed92b..412ed6eb 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -3,20 +3,24 @@ import { Client } from '@sentry/types'; // add type to Vue context declare module 'vue/types/vue' { interface Vue { - $sentry: Client; + readonly $sentry?: Client; } } -// since nuxt 2.7.1 there is "NuxtAppOptions" for app context - see https://github.com/nuxt/nuxt.js/pull/5701 -declare module '@nuxt/vue-app' { +// App Context and NuxtAppOptions +declare module '@nuxt/types' { + interface Context { + readonly $sentry?: Client; + } + interface NuxtAppOptions { - $sentry: Client; + readonly $sentry?: Client; } } // add types for Vuex Store declare module 'vuex/types' { interface Store { - $sentry: Client; + readonly $sentry?: Client; } }