我安装了ng-select2 package。我收到此错误,代码无法在'ng serve'之后编译。
OS Windows 7
ERROR in d:/PATH-TO-PROJECT-FOLDER/node_modules/@types/select2/index.d.ts (233,49): 'JQuery' only refers to a type, but is being used as a namespace here.
ERROR in D:/PATH-TO-PROJECT-FOLDER/node_modules/ng-select2/ng-select2/ng-select2.component.ts (188,18): Cannot find name 'Select2Options'.
ERROR in /src/app/pages/dashboard/dashboard.component.ts (91,19): Cannot find name 'Select2Options'.
// Dashboard component ts(91, 19) error + I've also added import to it:
public options: Select2Options;
我尝试的解决方案是:
答案 0 :(得分:3)
正如github问题所述: SelectExptions界面被删除/重命名为最新版本4.0.45中的选项
要解决此问题,我只需通过运行将软件包降级到4.0.44 npm install @ types/select2@4.0.44 --save,这对我有用。