我在项目中安装了sweetalert2。但是,在我运行系统后安装它之后,它会产生一些错误。
ERROR in node_modules/@sweetalert2/ngx-sweetalert2/lib/swal.component.d.ts(101,9): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/@sweetalert2/ngx-sweetalert2/lib/swal.component.d.ts(107,9): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/@sweetalert2/ngx-sweetalert2/lib/swal.component.d.ts(121,9): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/@sweetalert2/ngx-sweetalert2/lib/swal.component.d.ts(122,9): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/@sweetalert2/ngx-sweetalert2/lib/swal.directive.d.ts(27,9): error TS1086: An accessor cannot be declared in an ambient
context.
node_modules/@sweetalert2/ngx-sweetalert2/lib/sweetalert2-loader.service.d.ts(9,9): error TS1086: An accessor cannot be declared in
an ambient context.
这是我的angular.json文件规格,
{
"dependencies": {
"@agm/core": "^1.0.0-beta.5",
"@angular/animations": "^8.0.0",
"@angular/cdk": "^8.0.0",
"@angular/common": "^8.0.0",
"@angular/compiler": "^8.0.0",
"@angular/core": "^8.0.0",
"@angular/forms": "^8.0.0",
"@sweetalert2/ngx-sweetalert2": "^8.0.0",
"sweetalert2": "^9.7.2",
"typeface-exo": "0.0.22",
"web-animations-js": "github:angular/web-animations-js#release_pr208",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.800.6",
"@angular/cli": "^8.3.25",
"@angular/compiler-cli": "^8.2.14",
"@angular/language-service": "8.0.0",
"@compodoc/compodoc": "1.0.1",
"npm-run-all": "4.0.2",
"ts-node": "3.2.2",
"tslint": "^5.20.1",
"tslint-language-service": "^0.9.9",
"typescript": "3.4.5"
}
}
如何解决此问题?
用途:
npm install sweetalert2
这不是问题