按照现有项目中的简单教程https://github.com/akmittal/ngx-confirm#ngxconfirm,给我错误,将以下内容导入component.ts文件
import { NgxConfirmModule } from 'ngx-confirm/ngx-confirm.module';
浏览器中带有黑色bacground的错误消息如下
in [at-loader] ./node_modules/ngx-confirm/ngx-confirm.component.ts:32:3
TS7008: Member 'confirmModal' implicitly has an 'any' type.
ERROR in [at-loader] ./node_modules/ngx-confirm/ngx-confirm.component.ts:49:5
TS2322: Type 'null' is not assignable to type 'Confirm'.
ERROR in [at-loader] ./node_modules/ngx-confirm/ngx-confirm.component.ts:55:5
TS2322: Type 'null' is not assignable to type 'Confirm'
我无法在任何地方找到这个。
答案 0 :(得分:0)
检查noImplicitAny
文件中的tsconfig
值。
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false // <-----
},
"exclude": [
"node_modules",
"typings/main",
"typings/main.d.ts"
]
}
将其设置为false以解决此错误。
答案 1 :(得分:0)
在为整个应用禁用noImplicitAny之前,仅仅因为一个小的依赖项缺少正确的输入,请尝试以下选项:
"skipLibCheck": true
添加到tsconfig.json compilerOptions
。ngx-confirm.module
的明确排序:Link 在typings.d.ts中添加:
declare module 'ngx-confirm' {
const lib: any;
export = lib;
}