You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using a module, for example @nuxt/ui, and installing dependencies with pnpm, the extended type for NuxtConfig is not being picked up by Typescript (both tsc and vue-tsc). This leads to a type error in nuxt.config.ts:
nuxt.config.ts:5:3 - error TS2353: Object literal may only specify known properties, and 'ui' does not exist in type 'InputConfig<NuxtConfig, ConfigLayerMeta>'.
5 ui: {
~~
Found 1 error in nuxt.config.ts:5
Additionally, I found that:
the extended interface is present in .nuxt/schema.d.ts
removing node_modules and reinstalling with npm will fix the error
type casting the input parameter of defineNuxtConfig as InputConfig<NuxtConfig> will circumvent the issue, but requires me to add c12 as a dependency
Additional context
This is my first project using pnpm, but I decided to give it a go after I saw nuxt itself uses it. Because of that I was also surprised I did not find any other issues mentioning this. So perhaps this is a misconfiguration on my end, and people here know the answer straight away. But I decided to open a bug since I could easily reproduce the issue with Stackblitz.
Logs
No response
The text was updated successfully, but these errors were encountered:
Hi @huang-julien! When I install with --shamefully-hoist it types correctly, so I reckon the error is in the node_modules struture of pnpm.
Any clue on why this happens? If I have to use that flag I probably just switch back to npm. Not really a problem, but I wonder if there's something to be fixed here.
Environment
Reproduction
https://stackblitz.com/edit/github-yurofm?file=package.json,nuxt.config.ts
Describe the bug
When using a module, for example
@nuxt/ui
, and installing dependencies withpnpm
, the extended type for NuxtConfig is not being picked up by Typescript (bothtsc
andvue-tsc
). This leads to a type error innuxt.config.ts
:Additionally, I found that:
.nuxt/schema.d.ts
node_modules
and reinstalling withnpm
will fix the errordefineNuxtConfig
asInputConfig<NuxtConfig>
will circumvent the issue, but requires me to addc12
as a dependencyAdditional context
This is my first project using
pnpm
, but I decided to give it a go after I sawnuxt
itself uses it. Because of that I was also surprised I did not find any other issues mentioning this. So perhaps this is a misconfiguration on my end, and people here know the answer straight away. But I decided to open a bug since I could easily reproduce the issue with Stackblitz.Logs
No response
The text was updated successfully, but these errors were encountered: