编程语言
首页 > 编程语言> > javascript – Angular 5 ng-bootstrap类型’ElementRef’不是通用的错误

javascript – Angular 5 ng-bootstrap类型’ElementRef’不是通用的错误

作者:互联网

我在这些版本中使用angular 5和ng-bootstrap:

  "private": true,
  "dependencies": {
    "@angular/animations": "^5.2.0",
    "@angular/common": "^5.2.0",
    "@angular/compiler": "^5.2.0",
    "@angular/core": "^5.2.0",
    "@angular/forms": "^5.2.0",
    "@angular/http": "^5.2.0",
    "@angular/platform-browser": "^5.2.0",
    "@angular/platform-browser-dynamic": "^5.2.0",
    "@angular/router": "^5.2.0",
    "@ng-bootstrap/ng-bootstrap": "^2.1.0",
    "angular-in-memory-web-api": "^0.5.4",
    "angular2-moment": "^1.9.0",
    "bootstrap": "^4.1.1",
    "core-js": "^2.4.1",
    "date-util": "^1.2.1",
    "material-icons": "^0.2.1",
    "ngx-bootstrap": "^3.0.0",
    "normalize.css": "^8.0.0",
    "rxjs": "^5.5.6",
    "zone.js": "^0.8.19"
  },

当我得到服务有这个错误:

**

Failed to compile.

node_modules/@ng-bootstrap/ng-bootstrap/buttons/radio.d.ts(58,96):
error TS2315: Type ‘ElementRef’ is not generic.
node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker-input.d.ts(121,67):
error TS2315: Type ‘ElementRef’ is not generic.
node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker.d.ts(115,208):
error TS2315: Type ‘ElementRef’ is not generic.
node_modules/@ng-bootstrap/ng-bootstrap/dropdown/dropdown.d.ts(12,45):
error TS2315: Type ‘ElementRef’ is not generic.
node_modules/@ng-bootstrap/ng-bootstrap/dropdown/dropdown.d.ts(29,45):
error TS2315: Type ‘ElementRef’ is not generic.
node_modules/@ng-bootstrap/ng-bootstrap/dropdown/dropdown.d.ts(37,44):
error TS2315: Type ‘ElementRef’ is not generic.
node_modules/@ng-bootstrap/ng-bootstrap/modal/modal-window.d.ts(13,40):
error TS2315: Type ‘ElementRef’ is not generic.

解决方法:

我遇到过同样的问题.所以我没有阻止ng-bootstrap.

然后我直接重新安装它的2.0.0版本.

npm install –save @ ng-bootstrap / ng-bootstrap @ 2.0.0

标签:ng-bootstrap,javascript,angular,node-js,angular5
来源: https://codeday.me/bug/20190910/1799423.html