我试图在项目中使用log4javascript,我发现包的node_modules/log4javascript/中确实存在log4javascript.d.ts,package.json在“typings”属性中引用了它,但在编译我的项目时,它抱怨:
S2307:找不到模块“log4javascript”
我正在使用以下方法导入模块:
import {getLogger } from 'log4javascript';
据我所知,用户无需单独安装打字:
npm安装@types/log4javascript
"noImplicitAny": true,
在my tsconfig.json中设置
我的tsconfig.json看起来像:
{
"compileOnSave": true,
"compilerOptions": {
"noImplicitAny": true,
"removeComments": true,
"preserveConstEnums": true,
"sourceMap": true,
"target": "es2015",
"declaration": true
},
"include": [
"static/js/**/*"
],
"exclude": [
"node_modules",
"**/*.spec.ts"
]
}