pnpm exec nuxt typecheck failing
Running @nuxt/image v1.10.0
When I run pnpm exec nuxt typecheck, I'm getting the following error. I've included my package.json as well.
ℹ Nuxt Icon server bundle mode is set to local 6:25:01 AM
✔ Nuxt Icon discovered local-installed 2 collections: lucide, simple-icons 6:25:02 AM
ℹ Running with compatibility version 4 nuxt 6:25:02 AM
node_modules/.pnpm/@[email protected][email protected][email protected][email protected][email protected]/node_modules/@nuxt/image/dist/runtime/components/NuxtImg.vue:41:7 - error TS7022: 'attrs' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
41 const attrs = useAttrs()
~~~~~
Found 1 error in node_modules/.pnpm/@[email protected][email protected][email protected][email protected][email protected]/node_modules/@nuxt/image/dist/runtime/components/NuxtImg.vue:41
{
"name": "myapp",
"private": true,
"type": "module",
"scripts": {
"build": "nuxt build",
"dev": "~/Development/myapp/boot.sh",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare",
"lint": "eslint .",
"typecheck": "nuxt typecheck"
},
"dependencies": {
"@iconify-json/lucide": "^1.2.29",
"@iconify-json/simple-icons": "^1.2.28",
"@nuxt/content": "3.3.0",
"@nuxt/image": "1.10.0",
"@nuxt/scripts": "0.11.2",
"@nuxt/test-utils": "3.17.2",
"@nuxt/ui-pro": "^3.0.0",
"@unovis/ts": "^1.5.1",
"@unovis/vue": "^1.5.1",
"@vueuse/nuxt": "^13.0.0",
"date-fns": "^4.1.0",
"nuxt": "^3.16.0",
"valibot": "^1.0.0",
"zod": "^3.24.2"
},
"devDependencies": {
"@nuxt/eslint": "^1.2.0",
"eslint": "^9.22.0",
"eslint-config-prettier": "^10.1.1",
"eslint-plugin-prettier": "^5.2.3",
"prettier": "^3.5.3",
"typescript": "^5.8.2",
"vue-tsc": "^2.2.2"
},
"resolutions": {
"vue-tsc": "2.2.2"
},
"packageManager": "[email protected]",
"pnpm": {
"onlyBuiltDependencies": [
"@parcel/watcher",
"better-sqlite3",
"esbuild",
"sharp",
"maplibre-gl",
"vue-demi"
]
}
}
We're experiencing the same or a very similar issue.
In our template, we're running into this as well 👇
https://github.com/cesswhite/v4.20/tree/feature/add-nuxtimg-module
Ran into this as well. For me upgrading to vue-tsc 2.2.10 (this version works with NuxtUI just like 2.2.2) fixed the issue.
Thanks @GreenmeisterDavid I will check it out, today I tried the alpha version of NuxtImg and it also fixes this bug
@nuxt/image”: “v2.0.0-alpha.1
I can wait to fully upgrade to version 2 of the module.