最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

typescript - How to make types for the http module in Node.js work? - Stack Overflow

programmeradmin3浏览0评论

I have TS installed and my package.json looks like:

{
  "name": "blueapex",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "build": "tsc --build",
    "start": "node ./dist/index.js",
    "start:dev": "nodemon ./src/index.ts"
  },
  "author": "X X",
  "license": "ISC",
  "devDependencies": {
    "@types/node": "^22.10.7",
    "nodemon": "^3.1.9",
    "typescript": "^5.7.3"
  }
}

However, when try to work with the http module I do not get Intellisense despite restarting the TS server in Visual Studio Code.

import * as http from 'http';

http.createServer((req, res) => {

}).listen(8080);

After typing colon after req the intellisense doesn't work.

Restarted the TS server but it didn't help.

发布评论

评论列表(0)

  1. 暂无评论