【发布时间】:2018-04-30 02:12:24
【问题描述】:
我已经包含了一个 Typescript 定义文件,这样我就可以在 Typescript 中编写我非常基本的 node express 服务器。我已经安装了这些类型:
npm install @types/node --save-dev
遗憾的是,我的 IDE(VS 代码)仍然无法识别节点类型:
server.ts
import * as express from "express";
const app = express();
app.get('/', (req, res) => {
res.send('Hello Typescript!')
});
const server = app.listen(3000, () => {
console.log("listening on port 3000")
})
错误
app.get“函数”类型上不存在属性“get”
app.listen“功能”类型上不存在“侦听”属性
【问题讨论】:
标签: node.js typescript