Reputation: 526
I've been trying to do some prototyping using koa and Typescript2.0.
I've set up a simple project with the following tsconfig.json :
{
"compilerOptions": {
"outDir": "./bin/",
"sourceMap": true,
"noImplicitAny": true,
"module": "commonjs",
"target": "es6",
"jsx": "react",
"typeRoots": [
"node_modules/@types"
],
"types": [
"node"
]
},
"include": [
"./src/**/*"
]
}
I installed the node definition file via npm install --save @types/node
and I'm now trying to import a node module with import Morgan = require('koa-morgan')
but this keeps throwing the error: error TS7016: Could not find a declaration file for module 'koa-morgan'.
I'm using VScode and I properly updated the tsdk so that's not the issue.
What am I missing? Thanks in advance!
Upvotes: 0
Views: 610
Reputation: 22382
You should either get typings for koa-morgan
and include them the same way as you did for node
, or if they are not available and you have time and will - create one yourself.
Otherwise just import then the defaul javascript way:
const Morgan = require('koa-morgan');
But that will leave you without type checks from typescript aswell
Upvotes: 3