vuetify-nuxt-module icon indicating copy to clipboard operation
vuetify-nuxt-module copied to clipboard

[Nuxt 4] custom runtime hook type error

Open kingyue737 opened this issue 5 months ago • 1 comments

Reproduction

https://stackblitz.com/edit/github-xblyxqpf

Description

app/plugins/vuetify.ts:2:16 - error TS2345: Argument of type '"vuetify:configuration"' is not assignable to parameter of type 'HookKeys<RuntimeNuxtHooks>'.

2   nuxtApp.hook('vuetify:configuration', () => {
                 ~~~~~~~~~~~~~~~~~~~~~~~


Found 1 error.

Nuxt now generates separate TypeScript configurations for different contexts to provide better type-checking experiences

Ref: https://nuxt.com/docs/4.x/getting-started/upgrade#typescript-configuration-splitting

.nuxt/nuxt.node.d.ts which includes required types /// <reference types="vuetify-nuxt-module" /> is now longer included in the tsconfig for runtime code. Those types may need to be moved to something like vuetify-nuxt-module/runtime

workaround:

export default defineNuxtConfig({
  typescript: {
    tsconfig:{
      compilerOptions: {
        types: ['vuetify-nuxt-module'],
      }
    }
  },
}

Others

vuetify.config.ts also needs to be included in tsconfig.node.json. My current workaround is

// nuxt.config.ts
export default defineNuxtConfig({
  typescript: {
    nodeTsConfig: {
      include: ['../vuetify.config.ts'],
    },
  },
}

kingyue737 avatar Jul 22 '25 04:07 kingyue737

@kingyue737 should be fixed soon with the new version check https://github.com/userquin/vuetify-nuxt-module-nuxt-v4

userquin avatar Oct 01 '25 05:10 userquin