Angular 错误 ;TS2440和#x9;(TS)进口申报与当地申报的'冲突;插拔图';
我正在尝试在Visual studio 2017中运行我的应用程序,但我不断收到错误:Angular 错误 ;TS2440和#x9;(TS)进口申报与当地申报的'冲突;插拔图';,angular,visual-studio,Angular,Visual Studio,我正在尝试在Visual studio 2017中运行我的应用程序,但我不断收到错误: "Error TS2440 (TS) Import declaration conflicts with local declaration of 'PluginConfig'" "compilerOptions": { ..., "skipLibCheck": true } 我试着降低打字稿的等级,但错误并没有消失。下面是我的package.jso
"Error TS2440 (TS) Import declaration conflicts with local declaration of 'PluginConfig'"
"compilerOptions": {
...,
"skipLibCheck": true
}
我试着降低打字稿的等级,但错误并没有消失。下面是我的package.json文件:
{
"name": "frontend",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build --prod",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^5.2.4",
"@angular/cdk": "^5.2.1",
"@angular/common": "^5.2.0",
"@angular/compiler": "^5.2.0",
"@angular/core": "^5.2.0",
"@angular/flex-layout": "^5.0.0-beta.14",
"@angular/forms": "^5.2.0",
"@angular/http": "^5.2.0",
"@angular/material": "^5.2.1",
"@angular/platform-browser": "^5.2.0",
"@angular/platform-browser-dynamic": "^5.2.0",
"@angular/router": "^5.2.0",
"ajv": "^6.0.0",
"angular2-text-mask": "^9.0.0",
"angular5-time-picker": "^1.0.8",
"bootstrap": "4.3.1",
"core-js": "^2.4.1",
"font-awesome": "^4.7.0",
"jquery": "^1.9.1",
"ngx-mask": "^2.9.6",
"popper.js": "^1.12.9",
"rxjs": "^5.5.6",
"text-mask-addons": "^3.7.2",
"zone.js": "^0.8.19"
},
"devDependencies": {
"@angular/cli": "1.6.7",
"@angular/compiler-cli": "^5.2.0",
"@angular/language-service": "^5.2.0",
"@types/jasmine": "~2.8.3",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"codelyzer": "^4.0.1",
"jasmine-core": "~2.8.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^2.0.4",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "^5.3.2",
"ts-node": "~4.1.0",
"tslint": "~5.9.1",
"typescript": "~2.5.3"
}
}
以下是angular/cli版本的屏幕截图:
我尝试在Visual studio 2017和2019中打开应用程序,但在Visual studio的两个版本中都出现了相同的错误。我还尝试在VisualStudio中更改typescript版本,但也没有成功。以下是Visual studio Typescript版本的屏幕截图:
如果您能帮助解决此错误,我们将不胜感激。显然,这是Typescript大于3.6.4的最新版本的问题。据我所知,在我现在使用的3.7或3.8版本中还没有对它进行修复 您可以将以下内容添加到根文件夹中的tsconfig.json,以消除错误:
"Error TS2440 (TS) Import declaration conflicts with local declaration of 'PluginConfig'"
"compilerOptions": {
...,
"skipLibCheck": true
}
此解决方案在此线程中提供:
刚刚用VSCode和Angular 9遇到了这个问题。问题似乎是VSCode从量角器而不是@angular/core自动导入EventEmitter。我想知道为什么VSCode抱怨EventEmitter没有可用的subscribe()方法
从“量角器”导入{EventEmitter}代码>
应该是
从'@angular/core'导入{EventEmitter}代码>
更改了导入,一切正常。我一放入skipLibCheck,错误就消失了。非常感谢。我看到被接受的答案已经变成了这个答案,但我不确定这是怎么回事。这似乎与最初的问题无关,我倾向于同意。我的评论只是针对症状,而不是具体问题。