属性 'close' 在类型 'Application' 上不存在

Property 'close' does not exist on type 'Application'

我是这样导入 expressjs 的:

import { Request, Response, Application, Router } from 'express';
const app: Application = require('express')();

并在 typings.json 中:

 "express": "registry:npm/express#4.14.0+20160925001530",

当我输入 app.close() 时,我得到:

[ts] Property 'close' does not exist on type 'Application'.

提供的应用程序定义没有关闭方法...服务器有,(app:Application).listen returns 一个服务器。

start(){
    server = app.listen(options.port, function () {
        debug('Server listening on port ' + options.port)
    })
}
stop(){
    server.stop();
}

您可以报告明确键入的类型 here. This is the package coming from npm

Typescript 很难。