I made a very simple Node project (
, accept all defaults) and opened it in VS Code. I followed the instructions in the docs
to turn on global implicit type checking: set
in user prefs.
Now, when I try to use
in the code, I get a red squiggly underline with the error
[js] Cannot find name 'require'.
Do I need to do something to tell the Typescript server that this will run in a Node environment, and thus
will be provided as a global?
ETA: I'm not totally clear on the disconnect between whatever is generating the "Cannot find name" error, and whatever is creating Intellisense suggestions. In spite of the
error, Intellisense works correctly. If I
npm install --save moment
, then write
const moment = require("moment");
then I get Intellisense completion of Moment functions, even though
has a red squiggly line under it.