Skip to content

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

Closed

Description

@uberspeck

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 angular-cli@1.0.0 / angular@4.0.0 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.

Activity

  1. kunshao-msft commented on Mar 29, 2017

    @kunshao-msft

    same error. any update?

  2. uvv001 commented on Mar 30, 2017

    @uvv001

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

  3. SebastianSchenk commented on Mar 30, 2017

    @SebastianSchenk

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

  4. kuncevic commented on Apr 11, 2017

    @kuncevic

    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

  5. filipesilva commented on May 3, 2017

    @filipesilva
    Contributor

    Closing as answered by @kuncevic, cheers!

  6. angular-automatic-lock-bot commented on Sep 7, 2019

    @angular-automatic-lock-bot

    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.

  7. locked and limited conversation to collaborators on Sep 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions