Kakone
Kakone

Reputation: 121

TypeScript type definitions IntelliSense errors

With Visual Studio 2022, I have a lot of IntelliSense errors in the error list window about type definitions of the node_modules folder.
In my tsconfig.json file, I excluded the node_modules folder : "exclude": ["node_modules"].
In my csproj, I added the line <TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>.
But nothing works, I didn't succeed in removing these errors.

enter image description here

Upvotes: 6

Views: 1317

Answers (3)

Kakone
Kakone

Reputation: 121

The problem is fixed in Visual Studio 2022 17.3.

Upvotes: 0

Jeremy
Jeremy

Reputation: 1578

It will depend on your tsconfig - can you share your setup? Will want to exclude your dist file as well as your node_modules (and if you want tests/spec files).

"exclude": ["node_modules", "**/*.spec.ts", "dist"]

Webpack has not exported member compilation was the error i saw first - what are you importing with that? Docs here for webpack and typescript.

Wondering if your types are discoverable, could try adding below to tsconfig

"typeRoots": [
   "./node_modules/@types"
]

Upvotes: 0

Jacob Stamm
Jacob Stamm

Reputation: 1873

After lots of trial and error, I've gotten "exclude": ["./node_modules/**/*.*"] to successfully ignore node_modules. It didn't take effect until I restarted Visual Studio.

Upvotes: 3

Related Questions