I am upgrading an Angular project (created with Angular CLI) from 2 to 4. I have followed the upgrade instructions, but now the project does not compile, due to type errors like this one:
ERROR in /mypath/node_modules/typescript/lib/lib.dom.d.ts (6945,11):
Duplicate identifier 'Headers'.
To debug, I created a fresh Angular 4 project, again with the CLI, to compare against. The newly created project compiles without errors.
When I compre the file in question (lib.dom.d.ts), they are exactly the same, but in the upgraded project, the error is highlighted in VS Code, but not in the new project (left is upgraded, right is new project):
(interestingly, I have a lot of red indicators in the new project's scroll area, what are they trying to tell me?)
I thought I could figure out what the differences are between those two projects to fix the issue, but I'm not finding any.
Both projects return
./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 are the same:
{
"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"
]
}
}
So the question: what else could be causing the difference in behaviour?

