N
Nuxt5mo ago
Arpad

API route types stopped working

I've been working on a small app for a couple of days and everything went mostly fine. Randomly, earlier, types on $fetch for my API routes stopped working altogether. They are generated inside .nuxt/types/nitro-routes.d.ts but for some reason typescript just doesn't pick them up. - Both tsconfigs are the default ones. - Tried on nuxt 3.12.3 and 3.12.2, same issue - Tried reverting to an older commit I know worked, same issue - Tried disabling hybrid mode with Volar, no success - Tried restarting my pc, vscode, typescript server what feels like thousands of times - All other types are working (layout names, utilities, composables, nuxt.config, everything) - Created a new empty project to check any differences in types - everything seems to be fine here, but it still won't work in my project but it works in the empty one. - Tried removing .nuxt and node_modules. no luck It just won't work. I've tried everything and I'm out of ideas. How can I debug this? How can I inspect what the heck the TS server is doing that it's just not picking these types up?
1 Reply
Arpad
ArpadOP5mo ago
Ok so I have absolutely no idea what happened. I cloned the project again clean, installed it (still happened), went back more commits until I got it in a working state somehow. Then I just added code back to see what causes it to break. Got it in a working state, the code looks pretty much the same, so I have no idea what is happening but it works now. We'll see for how long.
Want results from more Discord servers?
Add your server