Skip to content
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

typings from angular2 conflict with project typings #5807

Closed
rolandjitsu opened this issue Dec 10, 2015 · 27 comments
Closed

typings from angular2 conflict with project typings #5807

rolandjitsu opened this issue Dec 10, 2015 · 27 comments
Labels
area: packaging Issues related to Angular's creation of npm packages effort3: weeks type: bug/fix

Comments

@rolandjitsu
Copy link

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.

@rolandjitsu
Copy link
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.

@manland
Copy link

manland commented Dec 10, 2015

👍

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 ?

@dsebastien
Copy link

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

@IgorMinar IgorMinar added this to the beta.0 milestone Dec 10, 2015
@xstof
Copy link

xstof commented Dec 11, 2015

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.

@rolandjitsu
Copy link
Author

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

@xstof
Copy link

xstof commented Dec 11, 2015

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

@rolandjitsu
Copy link
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 😕

@demurgos
Copy link

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.

@rolandjitsu
Copy link
Author

@demurgos would you mind sharing that setup?

@demurgos
Copy link

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

@IgorMinar
Copy link
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

@IgorMinar IgorMinar modified the milestones: beta.1, beta.0 Dec 15, 2015
@dsebastien
Copy link

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

@tapas4java
Copy link

90% now....Kudos to team!
On 15 Dec 2015 16:19, "Sebastien" notifications@github.com wrote:

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


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

@geyang
Copy link

geyang commented Dec 18, 2015

Second this one! Kudos to the team!

@geyang
Copy link

geyang commented Dec 18, 2015

Here in this commit of my project, introduction of the angular2 dependency in this commit causes duplicate identifier error:

escherpad/luna@4e3c793

@IgorMinar
Copy link
Contributor

We'll fix this by the end of the year.
On Thu, Dec 17, 2015 at 9:55 PM Ge Yang notifications@github.com wrote:

Here in this commit of my project, introduction of the angular2 dependency
in this commit causes duplicate identifier error:

escherpad/luna@4e3c793
escherpad/luna@4e3c793


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

@stasberkov
Copy link

Any change to get this fixed till the end of this year?

@masaeedu
Copy link

@demurgos Any chance of getting your setup on Github or a gist? Please and thanks.

@demurgos
Copy link

demurgos commented Jan 2, 2016

Sorry for the delay, but here is the repo where I experiment with Angular 2.
I still had to create a small .d.ts manually for the browser to avoid conflicts with Angular2.
For this repo I converted the socket.io typings from DefinitelyTyped to the typings' external module format and it works really well with tsc and WebStorm.
Switching to external module definitions and letting typings or an other tool handle the ambient definitions looks like a good idea to me.
typings is not the only project working on better TS definitions, typescript itself seems to be working on a better system so I hope that all these conflicts will be solved soon.

@jomeier
Copy link
Contributor

jomeier commented Jan 5, 2016

For me commenting out Line 14 (/// ) in:

/node_modules/angular2/manual_typings/globals-es6.d.ts

removed my TS2300 errors (conflicted with node).

@IgorMinar
Copy link
Contributor

We are working on the fix. It's not trivial. If no more complications
appear, the fix will be part of beta.1 or 2 this week or the next.
On Tue, Jan 5, 2016 at 4:57 AM Josef Meier notifications@github.com wrote:

For me commenting out Line 14 (/// ) in:

/node_modules/angular2/manual_typings/globals-es6.d.ts

removed my TS2300 errors (conflicted with node).


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

@mhevery mhevery modified the milestones: beta.01, beta.02 Jan 25, 2016
@mhevery mhevery removed this from the beta.01 milestone Jan 25, 2016
@mhevery mhevery added type: bug/fix P2: required effort2: days area: packaging Issues related to Angular's creation of npm packages labels Jan 26, 2016
@mhevery mhevery removed this from the beta.02 milestone Jan 26, 2016
@Finkes
Copy link

Finkes commented Jan 28, 2016

is there anything new to this?

@NikGovorov
Copy link

@Finkes, still the same for me in beta1.

alexeagle added a commit to alexeagle/angular that referenced this issue Jan 31, 2016
This resolves Duplicate Identifier issues seen by many users,
at the expense of more typings installation required in some
cases.

Removes the quickstart hack of placing all needed dependencies
typings files in our distribution. Removes dependencies on
nodejs from angular2/core.

Fixes angular#5973
Fixes angular#5807
Fixes angular#6266

Angular now depends on es6-promise and es6-collections
(and a handful of manual typings) rather than all of es6-shim.

Fixes angular#5242

BREAKING CHANGE:

Transitive typings are no longer included in the distribution.
You may need to install typings in your project using
http://github.com/typings/typings

Users now must rely on getting typings from:
- one of the peerDependencies, such as rxjs, which exposes
  typings via the moduleResolution=node mechanism.
- a manually installed typing for peerDependencies which do
  not expose typings
- a manually installed polyfill typing for --target ES5
- a library they choose to use at runtime, eg. nodejs
@alexeagle
Copy link
Contributor

I am working on it right now, #6267
Needs a change in zone.js to expose the typings, then should be ready.

alexeagle added a commit to alexeagle/angular that referenced this issue Feb 1, 2016
This resolves Duplicate Identifier issues seen by many users,
at the expense of more typings installation required in some
cases.

Removes the quickstart hack of placing all needed dependencies
typings files in our distribution. Removes dependencies on
nodejs from angular2/core.

Fixes angular#5973
Fixes angular#5807
Fixes angular#6266

Angular now depends on es6-promise and es6-collections
(and a handful of manual typings) rather than all of es6-shim.

Fixes angular#5242

BREAKING CHANGE:

Transitive typings are no longer included in the distribution.
You may need to install typings in your project using
http://github.com/typings/typings

Users now must rely on getting typings from:
- one of the peerDependencies, such as rxjs, which exposes
  typings via the moduleResolution=node mechanism.
- a manually installed polyfill typing for --target ES5
- a library they choose to use at runtime, eg. nodejs
alexeagle added a commit to alexeagle/angular that referenced this issue Feb 1, 2016
This resolves Duplicate Identifier issues seen by many users,
at the expense of more typings installation required in some
cases.

Removes the quickstart hack of placing all needed dependencies
typings files in our distribution. Removes dependencies on
nodejs from angular2/core.

Fixes angular#5973
Fixes angular#5807
Fixes angular#6266

Angular now depends on es6-promise and es6-collections
(and a handful of manual typings) rather than all of es6-shim.

Fixes angular#5242

BREAKING CHANGE:

Transitive typings are no longer included in the distribution.
You may need to install typings in your project using
http://github.com/typings/typings

Users now must rely on getting typings from:
- one of the peerDependencies, such as rxjs, which exposes
  typings via the moduleResolution=node mechanism.
- a manually installed polyfill typing for --target ES5
- a library they choose to use at runtime, eg. nodejs
alexeagle added a commit to alexeagle/angular that referenced this issue Feb 1, 2016
This resolves Duplicate Identifier issues seen by many users,
at the expense of more typings installation required in some
cases.

Removes the quickstart hack of placing all needed dependencies
typings files in our distribution. Removes dependencies on
nodejs from angular2/core.

Fixes angular#5973
Fixes angular#5807
Fixes angular#6266

Angular now depends on es6-promise and es6-collections
(and a handful of manual typings) rather than all of es6-shim.

Fixes angular#5242

BREAKING CHANGE:

Transitive typings are no longer included in the distribution.
You may need to install typings in your project using
http://github.com/typings/typings

Users now must rely on getting typings from:
- one of the peerDependencies, such as rxjs, which exposes
  typings via the moduleResolution=node mechanism.
- a manually installed polyfill typing for --target ES5
- a library they choose to use at runtime, eg. nodejs
@Slals
Copy link

Slals commented Feb 4, 2016

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

@alexeagle
Copy link
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 notifications@github.com
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).

alexeagle added a commit to alexeagle/angular that referenced this issue Feb 4, 2016
This resolves Duplicate Identifier issues seen by many users,
at the expense of more typings installation required in some
cases.

Removes the quickstart hack of placing all needed dependencies
typings files in our distribution. Removes dependencies on
nodejs from angular2/core.

Fixes angular#5973
Fixes angular#5807
Fixes angular#6266

Angular now depends on es6-promise and es6-collections
(and a handful of manual typings) rather than all of es6-shim.

Fixes angular#5242

BREAKING CHANGE:

Transitive typings are no longer included in the distribution.
You may need to install typings in your project using
http://github.com/typings/typings

Users now must rely on getting typings from:
- one of the peerDependencies, such as rxjs, which exposes
  typings via the moduleResolution=node mechanism.
  (see https://github.com/Microsoft/TypeScript/wiki/Typings-for-npm-packages)
  This happens automatically.
- Using --target ES5 now requires manual installation of
  es6-promise and es6-collections typings.
- Using some angular APIs may introduce a dependency on eg. nodejs
  and that typings needs manual installation as well.
alexeagle added a commit to alexeagle/angular that referenced this issue Feb 4, 2016
This resolves Duplicate Identifier issues seen by many users,
at the expense of more typings installation required in some
cases.

Removes the quickstart hack of placing all needed dependencies
typings files in our distribution. Removes dependencies on
nodejs from angular2/core.

Fixes angular#5973
Fixes angular#5807
Fixes angular#6266

Angular now depends on es6-promise and es6-collections
(and a handful of manual typings) rather than all of es6-shim.

Fixes angular#5242

We previously had an undocumented breaking change, this is now
documented in this commit.

Fixes angular#6817

BREAKING CHANGE:

Transitive typings are no longer included in the distribution.
You may need to install typings in your project using
http://github.com/typings/typings

Users now must rely on getting typings from:
- one of the peerDependencies, such as rxjs, which exposes
  typings via the moduleResolution=node mechanism.
  (see https://github.com/Microsoft/TypeScript/wiki/Typings-for-npm-packages)
  This happens automatically.
- Using --target ES5 now requires manual installation of
  es6-promise and es6-collections typings.
- Using some angular APIs may introduce a dependency on eg. nodejs
  or jasmine, and those typings need manual installation as well.
alexeagle added a commit to alexeagle/angular that referenced this issue Feb 4, 2016
This resolves Duplicate Identifier issues seen by many users,
at the expense of more typings installation required in some
cases.

Removes the quickstart hack of placing all needed dependencies
typings files in our distribution. Removes dependencies on
nodejs from angular2/core.

Fixes angular#5973
Fixes angular#5807
Fixes angular#6266

Angular now depends on es6-promise and es6-collections
(and a handful of manual typings) rather than all of es6-shim.

Fixes angular#5242

We previously had an undocumented breaking change, this is now
documented in this commit.

Fixes angular#6817

BREAKING CHANGE:

Transitive typings are no longer included in the distribution.
You may need to install typings in your project using
http://github.com/typings/typings

Users now must rely on getting typings from:
- one of the peerDependencies, such as rxjs, which exposes
  typings via the moduleResolution=node mechanism.
  (see https://github.com/Microsoft/TypeScript/wiki/Typings-for-npm-packages)
  This happens automatically.
- Using --target ES5 now requires manual installation of
  es6-promise and es6-collections typings.
- Using some angular APIs may introduce a dependency on eg. nodejs
  or jasmine, and those typings need manual installation as well.
alexeagle added a commit to alexeagle/angular that referenced this issue Feb 4, 2016
This resolves Duplicate Identifier issues seen by many users,
at the expense of more typings installation required in some
cases.

Removes the quickstart hack of placing all needed dependencies
typings files in our distribution. Removes dependencies on
nodejs from angular2/core.

Fixes angular#5973
Fixes angular#5807
Fixes angular#6266

Angular now depends on es6-promise and es6-collections
(and a handful of manual typings) rather than all of es6-shim.

Fixes angular#5242

We previously had an undocumented breaking change, this is now
documented in this commit.

Fixes angular#6817

BREAKING CHANGE:

Transitive typings are no longer included in the distribution.
You may need to install typings in your project using
http://github.com/typings/typings

Users now must rely on getting typings from:
- one of the peerDependencies, such as rxjs, which exposes
  typings via the moduleResolution=node mechanism.
  (see https://github.com/Microsoft/TypeScript/wiki/Typings-for-npm-packages)
  This happens automatically.
- Using --target ES5 now requires manual installation of
  es6-promise and es6-collections typings.
- Using some angular APIs may introduce a dependency on eg. nodejs
  or jasmine, and those typings need manual installation as well.
alexeagle added a commit to alexeagle/angular that referenced this issue Feb 4, 2016
This resolves Duplicate Identifier issues seen by many users,
at the expense of more typings installation required in some
cases.

Removes the quickstart hack of placing all needed dependencies
typings files in our distribution. Removes dependencies on
nodejs from angular2/core.

Fixes angular#5973
Fixes angular#5807
Fixes angular#6266

Angular now depends on es6-promise and es6-collections
(and a handful of manual typings) rather than all of es6-shim.

Fixes angular#5242

We previously had an undocumented breaking change, this is now
documented in this commit.

Fixes angular#6817

BREAKING CHANGE:

Transitive typings are no longer included in the distribution.
You may need to install typings in your project using
http://github.com/typings/typings

Users now must rely on getting typings from:
- one of the peerDependencies, such as rxjs, which exposes
  typings via the moduleResolution=node mechanism.
  (see https://github.com/Microsoft/TypeScript/wiki/Typings-for-npm-packages)
  This happens automatically.
- Using --target ES5 now requires manual installation of
  es6-promise and es6-collections typings.
- Using some angular APIs may introduce a dependency on eg. nodejs
  or jasmine, and those typings need manual installation as well.
alexeagle added a commit to alexeagle/angular that referenced this issue Feb 4, 2016
This resolves Duplicate Identifier issues seen by many users,
at the expense of more typings installation required in some
cases.

Removes the quickstart hack of placing all needed dependencies
typings files in our distribution. Removes dependencies on
nodejs from angular2/core.

Fixes angular#5973
Fixes angular#5807
Fixes angular#6266

Angular now depends on es6-promise and es6-collections
(and a handful of manual typings) rather than all of es6-shim.

Fixes angular#5242

We previously had an undocumented breaking change, this is now
documented in this commit.

Fixes angular#6817

BREAKING CHANGE:

Transitive typings are no longer included in the distribution.
You may need to install typings in your project using
http://github.com/typings/typings

Users now must rely on getting typings from:
- one of the peerDependencies, such as rxjs, which exposes
  typings via the moduleResolution=node mechanism.
  (see https://github.com/Microsoft/TypeScript/wiki/Typings-for-npm-packages)
  This happens automatically.
- Using --target ES5 now requires manual installation of
  es6-promise and es6-collections typings.
- Using some angular APIs may introduce a dependency on eg. nodejs
  or jasmine, and those typings need manual installation as well.
alexeagle added a commit to alexeagle/angular that referenced this issue Feb 4, 2016
This resolves Duplicate Identifier issues seen by many users,
at the expense of more typings installation required in some
cases.

Removes the quickstart hack of placing all needed dependencies
typings files in our distribution. Removes dependencies on
nodejs from angular2/core.

Fixes angular#5973
Fixes angular#5807
Fixes angular#6266

Angular now depends on es6-promise and es6-collections
(and a handful of manual typings) rather than all of es6-shim.

Fixes angular#5242

We previously had an undocumented breaking change, this is now
documented in this commit.

Fixes angular#6817

BREAKING CHANGE:

Transitive typings are no longer included in the distribution.
You may need to install typings in your project using
http://github.com/typings/typings

Users now must rely on getting typings from:
- one of the peerDependencies, such as rxjs, which exposes
  typings via the moduleResolution=node mechanism.
  (see https://github.com/Microsoft/TypeScript/wiki/Typings-for-npm-packages)
  This happens automatically.
- Using --target ES5 now requires manual installation of
  es6-promise and es6-collections typings.
- Using some angular APIs may introduce a dependency on eg. nodejs
  or jasmine, and those typings need manual installation as well.
@mhevery mhevery closed this as completed in 2a70f4e Feb 4, 2016
@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
area: packaging Issues related to Angular's creation of npm packages effort3: weeks type: bug/fix
Projects
None yet
Development

No branches or pull requests