NuxtConfig typescript error
Hello guys! I have a typescript error that maybe you can help me with:
94 Replies
Hi, can you do npm install again and then start your devserver?
Seems like nuxt generated types doesn’t know about that new module yet
What’s the typescript error if you hover?
This happens for every module, if i delete the apollo config the i18n has the same error after
Okay seems like something is wrong with the types. Can you delete your .nuxt and package lock folder and npm install again?
It will regenerate it
Yes I did nuxt prepare again to generate it, but will try that way
(using turborepo)
yeah sometimes that’s not enough though
Okay no experience with turborepo, do you have a regular node_modules folder?
yap
npm i install regeneration did not work
Okay could you show the whole nuxt Config?
Any reason you import defineNuxtConfig manually? That’s an auto import
This is maybe why it doesn’t know about your local types
Good catch, I deleted it
Will restart the ts server
Still has the error
Arg 😄
😄
Is this okay:
Not exporting something
I will look into my generated nuxt folder
This seems all okey
The generation
Yeah this file looks similar to mine
Think that's okay since it's a
d.ts
file. So only for types, does not have to export something
Hmm let me think 😄
Which nuxt version are you using?I changed IDE's and is not an IDE thing
Ah okay that would be my next question. Sometimes I have to restart Volar/the IDE to make TS get in sync again
inteliJ gives the same error
OMG
I found it
You have nuxt/kit installed, so is this a module?
tell me 😄
Forget it it was a TS server restart noooo! Sorry ahahah
I removed this
And thought it was the solution but was just a restart
mb
😂 sometimes it's those things yeah
simplest things
Im creating modules locally in this nuxt repo so I can use in my app
It did not work
After restart
Still no answer
Got all hyped for nothing ahaha
My IDE tells me he is searching for nuxtConfig type here:
And not the generated ones
Maybe this helps
Hm but what you've shown is just the node_modules files, which of course does not contain "custom" project based types like for apollo or i18n
Yap
What do you mean by that
"My IDE tells me he is searching for nuxtConfig type here:"
When I do a Ctrl + click on the NuxtConfig the IDE forwards me there
Ah okay
Same for me though
Do you also have these files?
Seems slim compared with yours
Oh you don't, interesting
Yeah since these files add typings for the config
Can you run
nuxt prepare
again and see if it generates more?Same output
The modules are on the root node-modules and not this one, maybe could take effect on the output
Yeah that could indeed have an impact...
But do the modules work when you start the devserver? so is it just a TS issue?
They work, its just a ts issue
// @ts-ignore 😈
no just joking
it's wierd that its only generating this one "types" folder
Is it generating more when you start the devserver?
Ahahah you want to know my "fix":
😈
Hahahaha
yap it did
okay but no "modules" folder like on my project
exactly
If you want maybe you could create a minimal reprod with turborepo, maybe it's a bug with nuxt not recognizing the modules right
How do I do that kinda of thing? Code Sandbox?
Nuxt
Reporting Bugs
One of the most valuable roles in open source is taking the time to report bugs helpfully.
It clones an example repo into codesandbox or stackblitz if you click below
StackBlitz is super fast damn
Reproducing something like what I have seems to work..
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
What is it?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
You ura using i18n in a component?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
This seems to be working
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Its just a folder with a json file like this
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
How did you install i18n?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
npm install @nuxtjs/i18n@next --save-dev
use this one
You are using an outdated version that probably is for nuxt 2
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
How did you install nuxt?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Don't know.. Maybe up the nuxt version?
3.2
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
You welcome!
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Don't get me wrong but thank god.. I was going maniac finding a solution, now atleast I have company 😂
The types are being generated but defineNuxtConfig is not using them
Can you reproduce the issue just by installing 2 modules? Would be good to open an issue
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Nope, I have i18n, apollo and pinia in my case
It was working before, but when I moved the project to another folder it stopped working
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Unnistall for mean removing from defineNuxtConfig modules declaration or npm unninstall?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Will do tomorrow and reach back to you!
Open an issue on this or go to the all chat!
Couldnt find the time to test it today, any news?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
It drives me crazy tbh.. Hope I find the time to create an issue. One of my colleagues said it happens on react with vite aswell on certain packages
Could be not related tho..
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Makes sense yes
Will analyse it
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View