Skip to content

'Duplicate identifier' errors after upgrade to 1.0.0 final #5692

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
uberspeck opened this issue Mar 27, 2017 · 6 comments
Closed

'Duplicate identifier' errors after upgrade to 1.0.0 final #5692

uberspeck opened this issue Mar 27, 2017 · 6 comments

Comments

@uberspeck
Copy link

uberspeck commented Mar 27, 2017

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Versions.

@angular/cli: 1.0.0
node: 6.9.5
os: darwin x64
@angular/common: 4.0.0
@angular/compiler: 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/router: 4.0.0
@angular/cli: 1.0.0
@angular/compiler-cli: 4.0.0

Repro steps.

Upgrade to [email protected] / [email protected] and run ng-serve

The log given by the failure.

I very carefully followed the migration guide to upgrade from RC4 to final. When I run ng serve I'm seeing the following...

ERROR in /Users/[user]/dev/myProject/node_modules/typescript/lib/lib.dom.d.ts (6945,11): Duplicate identifier 'Headers'.
/Users/[user]/dev/myProject/node_modules/typescript/lib/lib.dom.d.ts (6954,13): Duplicate identifier 'Headers'.
/Users/[user]/dev/myProject/node_modules/typescript/lib/lib.dom.d.ts (9343,11): Duplicate identifier 'Request'.
/Users/[user]/dev/myProject/node_modules/typescript/lib/lib.dom.d.ts (9360,13): Duplicate identifier 'Request'.
/Users/[user]/dev/myProject/node_modules/typescript/lib/lib.dom.d.ts (14893,18): Duplicate identifier 'fetch'.
/Users/[user]/dev/myProject/node_modules/typescript/lib/lib.dom.d.ts (14898,6): Duplicate identifier 'BodyInit'.
/Users/[user]/dev/myProject/node_modules/typescript/lib/lib.dom.d.ts (14929,6): Duplicate identifier 'RequestInfo'.

ERROR in /users/[user]/dev/myProject/node_modules/@types/isomorphic-fetch/index.d.ts (23,14): Duplicate identifier 'BodyInit'.
/users/[user]/dev/myProject/node_modules/@types/isomorphic-fetch/index.d.ts (24,14): Duplicate identifier 'RequestInfo'.
/users/[user]/dev/myProject/node_modules/@types/isomorphic-fetch/index.d.ts (28,5): Subsequent variable declarations must have the same type.  Variable 'headers' must be of type 'any', but here h
as type 'string[] | Headers | { [index: string]: string; }'.
/users/[user]/dev/myProject/node_modules/@types/isomorphic-fetch/index.d.ts (30,5): Subsequent variable declarations must have the same type.  Variable 'mode' must be of type 'string', but here h
as type 'string | RequestMode'.
/users/[user]/dev/myProject/node_modules/@types/isomorphic-fetch/index.d.ts (31,5): Subsequent variable declarations must have the same type.  Variable 'credentials' must be of type 'string', but
 here has type 'string | RequestCredentials'.
/users/[user]/dev/myProject/node_modules/@types/isomorphic-fetch/index.d.ts (32,5): Subsequent variable declarations must have the same type.  Variable 'cache' must be of type 'string', but here
has type 'string | RequestCache'.
/users/[user]/dev/myProject/node_modules/@types/isomorphic-fetch/index.d.ts (41,15): Duplicate identifier 'Headers'.
/users/[user]/dev/myProject/node_modules/@types/isomorphic-fetch/index.d.ts (61,5): All declarations of 'bodyUsed' must have identical modifiers.
/users/[user]/dev/myProject/node_modules/@types/isomorphic-fetch/index.d.ts (81,15): Duplicate identifier 'Request'.
/users/[user]/dev/myProject/node_modules/@types/isomorphic-fetch/index.d.ts (115,13): Duplicate identifier 'fetch'.

ERROR in /Users/[user]/dev/myProject/node_modules/@types/lodash/index.d.ts (19417,15): All declarations of 'WeakMap' must have identical type parameters.
@kunshao-msft
Copy link

same error. any update?

@uvv001
Copy link

uvv001 commented Mar 30, 2017

This happens because typescript 2.2.1 include types for "fetch" function. Just remove isomorphic-fetch from package.json.

@SebastianSchenk
Copy link

I have the same problem after updating to final. After removing @types/isomorphic-fetch the error still occurs.

@kuncevic
Copy link

kuncevic commented Apr 11, 2017

Got same issue with whatwg-fetch.

I've got @types/whatwg-fetch installed as well that now I thought causing the problem with TS2.2.2 but after I uninstall it just didn't help.

Currently I am just commented the import 'whatwg-fetch'; in polyfils.ts.

UPDATE:
Based on this one microsoft/TypeScript#4948 sounds like Fetch API typings has already make their way to the latest typescript that is why custom file defs for fetch api are no longer needed.

What I've done now is just reinstalled whatwg-fetch and make sure that I do not have typings defs installed for that. So now import 'whatwg-fetch'; in polyfils.ts working just fine.

I think you have to do something similar in case of isomorphic-fetch

@filipesilva
Copy link
Contributor

Closing as answered by @kuncevic, cheers!

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants