My understanding is that when using JavaScript libraries in TypeScript, the recommended approach is to install the corresponding *.d.ts files from npm, typically found in the @types/
namespace.
This method works well for my own TypeScript projects. However, when using Vite with TypeScript, an additional step is required - adding "node_modules/@types/**/*.d.ts" to the includes
property in the provided tsconfig.json
.
On the other hand, Nuxt has its own automatically generated tsconfig.json
, which gets overwritten if attempting to add an include
property. This results in TypeScript not importing anything by default.
So where should I specify to include "node_modules/@types/**/*.d.ts"? And why isn't this the default setting?
How can I make sure TypeScript recognizes the declarations in the @types/
folder?