Skip to content

typings from angular2 conflict with project typings #5807

Closed

Description

@rolandjitsu

As I am already including:

"node/node.d.ts": {
    "commit": "e850b6ac0d59fee86dd7cb6a1be2caf6400bde14"
}

In my tsd.json file and angular also includes those, I get lots of error TS2300: Duplicate identifier ... errors.

Is there really no solution for this? If there is a solution, can someone point me to it because I cannot find something that would make it work, besides me not including these typings in my own tsd.json file.

Activity

  1. rolandjitsu commented on Dec 10, 2015

    @rolandjitsu
    Author

    Also, I need to include the jasmine typings that I need for some e2e tests that at this point do not import angular2 at all, so because I cannot include my own typings dependency in tsd.json (because of the duplicate identifier errors) I get errors like error TS2304: Cannot find name 'it'. So that is another annoying thing to see in the compilation output.

  2. manland commented on Dec 10, 2015

    @manland

    👍

    Same here 😢

    Also, i use express and it import node.ts like this :

    /// <reference path="../node/node.d.ts" />
    /// <reference path="../serve-static/serve-static.d.ts" />
    
    declare module Express {
    
        // These open interfaces may be extended in an application-specific manner via declaration merging.
        // See for example method-override.d.ts (https://github.com/borisyankov/DefinitelyTyped/blob/master/method-override/method-override.d.ts)
        export interface Request { }
        export interface Response { }
        export interface Application { }
    }

    Any idea on a solution please ?

  3. dsebastien commented on Dec 10, 2015

    @dsebastien

    See #5459 and #5395.
    This is indeed rather annoying atm :(

  4. added this to the beta.0 milestone on Dec 10, 2015
  5. xstof commented on Dec 11, 2015

    @xstof

    Same issue for electron projects, which each also reference node. When using electron with angular 2, because of angular bringing it's own node.d.ts typings, there's lots of duplicate identifier errors. Excluding the node.d.ts typings from angular 2 causes an error in "angular2/manual_typings/globals-es6.d.ts(14,1)": "node_modules/angular2/typings/node/node.d.ts' not found". I assume this is because there's a reference path in the globals-es6.d.ts file like this: <reference path="../typings/node/node.d.ts" />. So far this means I don't seem to be able to properly compile electron with angular 2.

  6. rolandjitsu commented on Dec 11, 2015

    @rolandjitsu
    Author

    @xstof it should still compile, but you will of course see all those nasty complaints in the compiler.

  7. xstof commented on Dec 11, 2015

    @xstof

    Thanks @rolandjitsu - much appreciate the answer; hope the issue will be resolved. Will stick with the compile errors now. When I exclude the node typings from angular it's only one error, coming from globals-es6.d.ts. Alternatively, I'm thinking of doing two gulp-driven compile steps (one for angular related code, using angular node typings; andone for my own core functionality with my npm node import).

  8. rolandjitsu commented on Dec 11, 2015

    @rolandjitsu
    Author

    @xstof I think we just have to be patient until all this typescript business get's more stable. As far as I know there is something in the pipeline, plus there is another development for this typings business called typings, an alternative to TSD which, from what I understand, should fix all these issues.

    But I haven't had the chance to give that tool a try, don't really know where to get started with it 😕

  9. demurgos commented on Dec 13, 2015

    @demurgos

    Hi,
    I tried typings this week and it nicely solves the duplicate definition errors. From what I could see, it downloads definitions as external modules and then compile it at the root of your project as module declarations. During this process, typings are defined only once and do not clutter the global namespace. Unless you explicitly require a typing, it won't bother you which is really neat.

  10. rolandjitsu commented on Dec 13, 2015

    @rolandjitsu
    Author

    @demurgos would you mind sharing that setup?

  11. demurgos commented on Dec 13, 2015

    @demurgos

    @rolandjitsu Sure, I'll just clean up my project, it should be ready tomorrow.

  12. IgorMinar commented on Dec 15, 2015

    @IgorMinar
    Contributor

    sorry folks, this will have to wait until beta.1 - we will fix it for sure though, the fact that we are reexporting typings and forcing our versions onto angular apps is not right

  13. modified the milestones: , beta.0 on Dec 15, 2015
  14. dsebastien commented on Dec 15, 2015

    @dsebastien

    86%, beta 0 is getting closer! That'll be a nice christmas gift for geeks =)

  15. 24 remaining items

  16. Slals commented on Feb 4, 2016

    @Slals

    Any update about this issue?

    I still have a problem with duplicate identifier when I import angular2/core...

    Also, I'm not able to find any quick fix with typings. Would anyone mind tell me how typings fixes the problem?

    typings init --upgrade
    typings install
    

    Will result in more duplicate identifier when compile. I compile with grunt ts

  17. alexeagle commented on Feb 4, 2016

    @alexeagle
    Contributor

    Typings cannot fix the problem, it contributes additional types, it can't
    remove any.
    The fix is coming, it did not make beta.3 yesterday partly because we need
    an rxjs release, but should be in beta.4.

    On Thu, Feb 4, 2016 at 6:33 AM Jonathan Serra [email protected]
    wrote:

    Any update about this issue?

    I still have a problem with duplicate identifier when I import
    angular2/core...

    Also, I'm not able to find any quick fix with typings. Would anyone mind
    tell me how typings fixes the problem?

    typings init --upgrade
    typings install

    Will result in more duplicate identifier when compile. I compile with grunt
    ts

    —
    Reply to this email directly or view it on GitHub
    #5807 (comment).

  18. 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.

  19. 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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions