NuxtN
Nuxt2y 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?
Was this page helpful?