我一直在尝试使用koa和Typescript2.0进行一些原型设计。
我用下面的tsconfig.json设置了一个简单的项目:
{
"compilerOptions": {
"outDir": "./bin/",
"sourceMap": true,
"noImplicitAny": true,
"module": "commonjs",
"target": "es6",
"jsx": "react",
"typeRoots": [
"node_modules/@types"
],
"types": [
"node"
]
},
"include": [
"./src/**/*"
]
}我通过npm install --save @types/node安装了节点定义文件,现在我正在尝试使用import Morgan = require('koa-morgan')导入节点模块,但这仍然抛出错误:error TS7016: Could not find a declaration file for module 'koa-morgan'.我正在使用VScode,并且我正确地更新了tsdk,所以这不是问题所在。
我遗漏了什么?提前感谢!
https://stackoverflow.com/questions/41466672
复制相似问题