I know that var someModule = require('someModule')
is generally replaced by import * as someModule from 'someModule'
but I can't figure out how to use Typescript/ES6 syntax to express the following Node.js code:
var server = require('http').Server(app);
After reading import and call a function with es6 I have tried the following:
import * as httpModule from 'http';
const server = httpModule.Server(app);
and the code does compile and run properly but I still get this TS error:
[ts] Property 'Server' does not exist on type 'typeof "http"'
.
I have @types/node and @types/express installed. Am I missing something?