tsconfig with jasmine or mocha

tsconfig with jasmine or mocha

By medeb | personalblog | 23 Apr 2025


1. tsconfig.json (Use with Caution):
As mentioned earlier, modifying tsconfig.json is generally not the best
approach. However, if all else fails, you can try these options:
types array:
Explicitly list only the types you want to include.
In your tsconfig.json, add or modify the types array:
JSON
{
 "compilerOptions": {
 // ... other options
 "types": ["mocha"] // Only include Mocha types
 }
}
typeRoots array:
Specify the directories where TypeScript should look for type
definitions.
This can help you control which type definitions are loaded.
JSON
{
 "compilerOptions": {
 // ... other options
 "typeRoots": ["./node_modules/@types"] // Only look in
node_modules/@types
 }
}
2. Troubleshooting Tips:
Clean Install: Always perform a clean install (rm -rf node_modules && npm
install) after making changes to dependencies.
VS Code Extensions: If you have any VS code extensions that might be
influencing typescript, disable them to test if they are contributing to
the issue.
3.Restart TypeScript Server: 
In VS Code, use "TypeScript: Restart TS
Server" from the command palette.
By systematically working through these steps, you should be able to
identify and eliminate the source of the duplicate type definitions.

5c370356982f0e79f71b09a4b0bf7d3ef3a37990b6c8cfc32c819cf5a3fdb80e.png

How do you rate this article?

4



personalblog
personalblog

My daily experience in crypto world

Publish0x

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.