From: Eduardo San Martin Morote Date: Wed, 13 Jul 2022 10:11:33 +0000 (+0200) Subject: fix(nuxt): correct type for `$nuxt` X-Git-Tag: @pinia/nuxt@0.3.0~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f1a5149a189d2f36e3c57cb5bf79eafb6544856;p=thirdparty%2Fvuejs%2Fpinia.git fix(nuxt): correct type for `$nuxt` BREAKING CHANGE: `$nuxt` usage in stores defaults to type `any` unless you install the `@nuxt/types` package. This is because that package is quite heavy and can cause conflicts in projects not requiring it. Note `$nuxt` is deprecated and shouldn't be used (cf the other breaking changes notes). --- diff --git a/packages/nuxt/src/runtime/plugin.vue2.ts b/packages/nuxt/src/runtime/plugin.vue2.ts index af237314..18b89581 100644 --- a/packages/nuxt/src/runtime/plugin.vue2.ts +++ b/packages/nuxt/src/runtime/plugin.vue2.ts @@ -32,11 +32,12 @@ export default (context: any, inject: any) => { declare module 'pinia' { export interface PiniaCustomProperties { /** - * Nuxt context. + * Nuxt context. Requires you to install `@nuxt/types` to have types. * * @deprecated use `useNuxtApp()` and global `$fetch()` instead. See * https://v3.nuxtjs.org/bridge/bridge-composition-api/ */ - $nuxt: import('@nuxt/schema').NuxtApp + // @ts-ignore: heavy types, must be added by the user + $nuxt: import('@nuxt/types').Context } }