I have set up a node.js project where I want to use VS-Code+Typescript.
If I use plain Javascript intellisense is working fine an VS-Code even loads Typescript defintions from the cache (e.g. ~/.cache/typescript/2.5/node_modules/@types/rethinkdb/index.d.ts). But in .ts files this doesn't work at all.
.js file (instellisense working)
.ts file (intellisense not working)
Both files are in the same folder.
My tsconfig.json looks like:
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"sourceMap": true,
"watch": true
}
}
Answering my own question:
Andy's comment gave me a hint, because there was no .d.ts file in the module folder of rethinkdb. So I copied the .d.ts file from the cache folder to the module folder. I also needed to install the types from DefinitelyTyped:
npm install --save-dev @types/node
I don't know if this is the recommended way to fix this issue or why VS-Code doesn't resolve the definition files automatically, but at least it works for me now.