]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
fix(nuxt): correct type for `$nuxt`
authorEduardo San Martin Morote <posva13@gmail.com>
Wed, 13 Jul 2022 10:11:33 +0000 (12:11 +0200)
committerEduardo San Martin Morote <posva@users.noreply.github.com>
Wed, 13 Jul 2022 10:32:58 +0000 (12:32 +0200)
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).

packages/nuxt/src/runtime/plugin.vue2.ts

index af237314552575fd09cb14cb298dca0a06335706..18b89581e6e3bdee691ac8a4e894a5f4a5498278 100644 (file)
@@ -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
   }
 }