应为 1 个参数,但在 angular 中得到 0 个
Expected 1 argument, but got 0 in angular
当我 运行 ng build --prod
时,我得到这个错误:
node_modules/ngx-image-viewer/ngx-image-viewer.d.ts. Component: Expected 1 arguments, but got 0
.
我确定 tsconfig.app.json 出了点问题。因此,我通过在 compilerOptions
中将 types: ["node"]
编辑为 types: []
来配置它。但是,然后我得到错误:ERROR in node_modules/aws-sdk/lib/http_response.d.ts:1:25 - error TS2307: Cannot find module 'stream'
。因此,无法配置 types: []
数组。因为,无论哪种方式我都会出错。
看看我的tsconfig.app.json:
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true
},
"files": [
"src/main.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.ts"
],
"exclude": [
"src/test.ts",
"src/**/*.spec.ts"
]
}
如何避免此错误:Expected 1 arguments, But got 0
。
看起来 ngx-image-viewer 没有将自己升级到 Angular 8。我只是瞥了一眼那个存储库,他们至少 2 年没有接触源代码了。
我不熟悉 ngx-image-viewer
库,但我的猜测是错误与 post-angular-8-定义 ViewChild
声明有关。
您可以分叉源代码,升级并重建它,或者降级您的 angular 版本。
当我 运行 ng build --prod
时,我得到这个错误:
node_modules/ngx-image-viewer/ngx-image-viewer.d.ts. Component: Expected 1 arguments, but got 0
.
我确定 tsconfig.app.json 出了点问题。因此,我通过在 compilerOptions
中将 types: ["node"]
编辑为 types: []
来配置它。但是,然后我得到错误:ERROR in node_modules/aws-sdk/lib/http_response.d.ts:1:25 - error TS2307: Cannot find module 'stream'
。因此,无法配置 types: []
数组。因为,无论哪种方式我都会出错。
看看我的tsconfig.app.json:
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true
},
"files": [
"src/main.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.ts"
],
"exclude": [
"src/test.ts",
"src/**/*.spec.ts"
]
}
如何避免此错误:Expected 1 arguments, But got 0
。
看起来 ngx-image-viewer 没有将自己升级到 Angular 8。我只是瞥了一眼那个存储库,他们至少 2 年没有接触源代码了。
我不熟悉 ngx-image-viewer
库,但我的猜测是错误与 post-angular-8-定义 ViewChild
声明有关。
您可以分叉源代码,升级并重建它,或者降级您的 angular 版本。