Typescript需要知道它
http存在。
更新
为节点安装类型definitinos:
npm install @types/node
旧答案
遵循这两个步骤
node.d.ts
从此处下载文件:https : //github.com/borisyankov/DefinitelyTyped/tree/master/node- 在文件顶部添加:
/// <reference path="node.d.ts" />
PS:请参阅示例测试文件:https : //github.com/borisyankov/DefinitelyTyped/blob/master/node/node-
tests.ts



