I am using Visual Studio code to develop NodeJS and Typescript. If I write this code:
import * as http from 'http';
Compilation says error TS2307: Cannot find module 'http'.
error TS2307: Cannot find module 'http'.
How to deal with this error?
Greetz
This worked for me:
npm install @types/node --save
I understand that some time has passed with the OP, however this is a more updated answer if someone encounters this problem.
I have the same problems. This is similar to what: https://github.com/TypeStrong/ts-node/issues/216
After setting the icons with:
typings install dt~node --global --save
And then added this to my file:
///<reference path="../typings/globals/node/index.d.ts"/>
And suddenly it will work.