Search code examples
angulartsconfig

Expected 1 argument, but got 0 in angular


When I run ng build --prod, I get this error: node_modules/ngx-image-viewer/ngx-image-viewer.d.ts. Component: Expected 1 arguments, but got 0.

I'm sure that there is something going wrong with tsconfig.app.json. So, I configured it by editing types: ["node"] to types: [] in compilerOptions. But, then I get error: ERROR in node_modules/aws-sdk/lib/http_response.d.ts:1:25 - error TS2307: Cannot find module 'stream'. So, there is no way of configuring types: [] array. Because, either the way I'm getting error.

Here have a look of my 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"
  ]
}

How can I avoid this error: Expected 1 arguments, But got 0.


Solution

  • Looks like ngx-image-viewer did not upgrade itself to Angular 8. I Just took a glimpse at that repository and they have not touched the source for at least 2 years.

    I am not familiar with ngx-image-viewer lib, but my guess is that error relates to a post-angular-8-definition of a ViewChild declaration.

    you can fork the source, upgrade and rebuild it, or, downgrade your angular version.