`#imports` types don't include server auto-imports
See original GitHub issueEnvironment
- 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 .
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:
- Created a year ago
- Comments:5 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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
…Hi. You can simply drop
#nitro
import.useRuntimeConfig
is globally available. BTW this still seems an issue that types stopped working. /cc @danielroe