我正在尝试在项目中使用 log4javascript,我看到该包确实在 node_modules/log4javascript/ 中存在 log4javascript.d.ts,并且 package.json 确实在“typings”属性中引用了它,但是在编译我的项目时它会抱怨和:
S2307:找不到模块“log4javascript”
我正在使用以下方法导入模块:
import {getLogger } from 'log4javascript';
据我了解,不需要单独安装类型:
npm install @types/log4javascript
因为打字已经存在。但如果我有以下情况,我不确定如何使用模块类型和方法:
"noImplicitAny": true,
在我的 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"
]
}