WebStorm 2018.1.5: No TypeScript code completion for @types/node

console.log((fileName => `The current filename is ${fileName}`)(__filename));

I am evaluating WebStorm 2018.1.5 for Node development with TypeScript. When I type the above TypeScript code in WebStorm I do not get code completion support for __filename. In fact I get no code completion for @types/node package. Why so?

https://gist.github.com/zsoumya/0bfd6d75786a504e6a4d5759ccd0c1e4#file-node-ts-sample-4-webstorm 

package.json contents:

{
"name": "testwsnode1",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./dist/app.js"
},
"dependencies": {},
"devDependencies": {
"@types/node": "^10.5.2"
}
}

TSConfig.json contents:

{
"compileOnSave": true,
"compilerOptions": {
"outDir": "./dist",
"target": "es2016",
"module": "commonjs",
"lib": [
"es2017",
"dom"
],
"sourceMap": true,
"strict": true,
"noImplicitAny": true,
"noUnusedLocals": true,
"noImplicitReturns": true,
"moduleResolution": "node",
"esModuleInterop": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,

"forceConsistentCasingInFileNames": true
}
}

 

1 comment

works fine for me using the same tsconfig and package.json:

 

can you recreate it in a new project? Does Ctrl+clickling __filename navigate to global var definition in index.d.ts?

0

Please sign in to leave a comment.