question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`#imports` types don't include server auto-imports

See original GitHub issue

Environment


  • Operating System: Linux
  • Node Version: v16.14.0
  • Nuxt Version: 3.0.0-27495976.e31c604
  • Package Manager: npm@8.3.1
  • Builder: vite
  • User Config: typescript, buildModules, components, windicss, autoImports, router, experimental, features, globalName, build, vite, loading, cli, alias, privateRuntimeConfig, publicRuntimeConfig, css
  • Runtime Modules: -
  • Build Modules: @vueuse/nuxt@8.2.5, nuxt-windicss@2.2.10

Reproduction

  • install new nuxt with v
  • open new ts file (server dir) then try import useRuntimeConfig from #nitro.
  • see error about missing type .
image

Describe the bug

Look like bug somewhere block system get d.ts file, because as i checked, we had definition file ../index.d.ts along with ../index.mjs.

Additional context

For anyone using this version and get same issue, this is workaround:

  • open or create new file in root project named : shim.d.ts
  • insert snippet to teach js get correct d.ts file
// fix nuxt 3 issue missing type hint in [#nitro]
declare module '#nitro' {
  export * from 'nitropack/dist/runtime/index.d'
}

Logs

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
danielroecommented, Apr 29, 2022

Update: we’ve now removed the #nitro alias and advise users to rely on the auto-imports.

I’ll leave this open as we now need to add the server auto-import types to #imports

2reactions
pi0commented, Apr 12, 2022

Hi. You can simply drop #nitro import. useRuntimeConfig is globally available. BTW this still seems an issue that types stopped working. /cc @danielroe

Read more comments on GitHub >

github_iconTop Results From Across the Web

Struggling with auto-imports in python, any examples or recs?
Does anybody have auto imports working in python? Currently I'm using mason , mason-lspconfig , and null-ls . I've used Jedi for python,...
Read more >
Auto import in Visual Studio Code only offering absolute path ...
My Visual Studio Code instance always imported the relative path even though it was from a different Lerna package. It turns out that...
Read more >
Auto import | IntelliJ IDEA Documentation - JetBrains
Basic procedures to create and optimize imports in IntelliJ IDEA. Learn more how to import the missing import or XML namespace.
Read more >
User Manual - rust-analyzer
Toolchain; VS Code; rust-analyzer Language Server Binary; Emacs ... Toggles the additional completions that automatically add imports when completed.
Read more >
JavaScript modules - MDN Web Docs
Use of native JavaScript modules is dependent on the import and ... If you don't, you'll get a strict MIME type checking error...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found