WebStorm TypeScript Support with node_modules

I am trying to create a simple TypeScript project in WebStorm that imports the Node.js. module I loaded the definition of the corresponding TypeScript library in the settings and specified --module commonjsin the compiler settings, but when I try to import the module, I get an error Cannot find external module.

This is the simplest example that I can think of. What am I missing here?

Source Code + Project LayoutLibrary settingsTypeScript Compiler Settings

+4
source share
2 answers

I think you might need it at the very top of your file:

/// <reference path="node.d.ts" />

I'm still not sure how to refer to certain types of node definitions that you loaded inside the Webstorm IDE.

Try manually loading node.d.ts from:

https://github.com/borisyankov/DefinitelyTyped/blob/master/node/node.d.ts

.

+2

tsconfig.json, WebStorm . " " > TypeScript

0

All Articles