각도가있는 프로젝트 (각도 CLI로 작성)를 2에서 4로 업그레이드 중입니다. 업그레이드 지침을 따라 왔지만 지금과 같은 유형 오류로 인해 프로젝트가 컴파일되지 않습니다. 하나를 디버깅하는유형 각도 2에서 4로 업그레이드 한 후 오류가 발생했습니다.
ERROR in /mypath/node_modules/typescript/lib/lib.dom.d.ts (6945,11):
Duplicate identifier 'Headers'.
, 나는 비교 대상 다시 CLI와 신선한 각도 4 프로젝트를 만들었습니다. 새로 생성 된 프로젝트는 오류없이 컴파일됩니다.
문제의 파일 (lib.dom.d.ts)을 컴파일하면 정확히 동일하지만 업그레이드 된 프로젝트에서 VS 코드에서는 오류가 강조 표시되지만 새 프로젝트에서는 강조 표시되지 않습니다 (왼쪽은 업그레이드, 바로 새로운 프로젝트)입니다 :
이(흥미롭게도, 나는 새 프로젝트의 스크롤 영역에 빨간색 표시를 많이 가지고, 그들이 말해하려고하는)
생각 I 문제를 해결하기 위해이 두 프로젝트의 차이점을 파악할 수는 있지만 찾을 수는 없습니다.
두 프로젝트는
./node_modules/tslint/bin/tslint -v
4.5.1
./node_modules/typescript/bin/tsc -v
Version 2.2.1
ng -v
@angular/cli: 1.0.0
node: 7.4.0
os: darwin x64
@angular/animations: 4.0.0
@angular/common: 4.0.0
@angular/compiler: 4.0.0
@angular/compiler-cli: 4.0.0
@angular/core: 4.0.0
@angular/forms: 4.0.0
@angular/http: 4.0.0
@angular/platform-browser: 4.0.0
@angular/platform-browser-dynamic: 4.0.0
@angular/platform-server: 4.0.0
@angular/router: 4.0.0
@angular/cli: 1.0.0
tsconfig.json이 같은 반환 :
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"baseUrl": "src",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2016",
"dom"
]
}
}
그래서 질문 : 행동의 차이의 원인이 될 수있는 그 밖의 무엇?
core-js의 버전이 동일한 지 확인하십시오. tsconfig에서 "lib"의 'dom'을 제거합니까? – pixelbits