Aijaz
Aijaz

Reputation: 730

error TS2315: Type 'ElementRef' is not generic. Ng Ant design

Some Content: Angular version: 5.2.0

""@angular/common": "^5.2.0",
"@angular/compiler": "^5.2.0", "rxjs": "^5.5.6","

I am trying to install Ng Ant Design. I understand the latest version might be built on Angular 7, so I have taken the previous version.

"ng-zorro-antd": "1.8.1"

I was getting errors for Angular CDK, so I deliberately installed

"@angular/cdk": "^5.2.0",
"@angular/material": "^5.2.0"

But I am still getting these errors

`ERROR in node_modules/ng-zorro-antd/node_modules/@angular/cdk/observers/typings/observe-content.d.ts(26,22): error TS2315: Type 'ElementRef' is not generic.

node_modules/ng-zorro-antd/node_modules/@angular/cdk/observers/typings/observe-content.d.ts(60,65): error TS2315: Type 'ElementRef' is not generic. node_modules/ng-zorro-antd/node_modules/@angular/cdk/overlay/typings/position/connected-position-strategy.d.ts(33,106): error TS2315: Type 'ElementRef' is not generic. node_modules/ng-zorro-antd/node_modules/@angular/cdk/a11y/typings/focus-monitor/focus-monitor.d.ts(117,30): error TS2315: Type 'ElementRef' is not generic. node_modules/ng-zorro-antd/node_modules/@angular/cdk/a11y/typings/focus-trap/focus-trap.d.ts(118,30): error TS2315: Type 'ElementRef' is not generic. node_modules/ng-zorro-antd/drawer/nz-drawer-ref.d.ts(1,28): error TS2307: Cannot find module 'rxjs/index'.

The package-lock.json file show this, so I tried installed "@angular/cdk": "6.4.7", as well, but that gets the same error.

"ng-zorro-antd": {
  "version": "1.8.1",
  "resolved": "https://registry.npmjs.org/ng-zorro-antd/-/ng-zorro-antd-1.8.1.tgz",
  "integrity": "sha512-XNEwzt535/rILb/tEEwYBd2Ex4B4BwH7dzlbJAcpZZnN2tbIJYGNUiwbHo/o6t41Fv0qAgF/zmIlI0wQH+U7yA==",
  "requires": {
    "@angular/cdk": "^6.0.0",
    "@ant-design/icons-angular": "^1.0.1",
    "date-fns": "^1.29.0",
    "tslib": "^1.9.0"
  },
  "dependencies": {
    "@angular/cdk": {
      "version": "6.4.7",
      "resolved": "https://registry.npmjs.org/@angular/cdk/-/cdk-6.4.7.tgz",
      "integrity": "sha512-18x0U66fLD5kGQWZ9n3nb75xQouXlWs7kUDaTd8HTrHpT1s2QIAqlLd1KxfrYiVhsEC2jPQaoiae7VnBlcvkBg==",
      "requires": {
        "tslib": "^1.7.1"
      }
    }
  }
}

Upvotes: 1

Views: 1567

Answers (1)

E. Sundin
E. Sundin

Reputation: 4180

You have a two options:

  • Upgrade your Angular dependencies to version 7 and install the new NgZorro
  • Downgrade NgZorro to version 0.7.1 to get a version compatible with Angular 5.x

See the package.json for their dependency history https://github.com/NG-ZORRO/ng-zorro-antd/blob/0.7.1/package.json

Upvotes: 1

Related Questions