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 · 26 comments

Comments

Projects
None yet
@rolandjitsu
Copy link

rolandjitsu commented Dec 10, 2015

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

This comment has been minimized.

Copy link
Author

rolandjitsu commented Dec 10, 2015

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

This comment has been minimized.

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

This comment has been minimized.

Copy link

dsebastien commented Dec 10, 2015

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

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

@xstof

This comment has been minimized.

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

This comment has been minimized.

Copy link
Author

rolandjitsu commented Dec 11, 2015

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

@xstof

This comment has been minimized.

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

This comment has been minimized.

Copy link
Author

rolandjitsu commented Dec 11, 2015

@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

This comment has been minimized.

Copy link

demurgos commented Dec 13, 2015

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

This comment has been minimized.

Copy link
Author

rolandjitsu commented Dec 13, 2015

@demurgos would you mind sharing that setup?

@demurgos

This comment has been minimized.

Copy link

demurgos commented Dec 13, 2015

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

@IgorMinar

This comment has been minimized.

Copy link
Member

IgorMinar commented Dec 15, 2015

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

This comment has been minimized.

Copy link

dsebastien commented Dec 15, 2015

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

@tapas4java

This comment has been minimized.

Copy link

tapas4java commented Dec 15, 2015

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

@episodeyang

This comment has been minimized.

Copy link

episodeyang commented Dec 18, 2015

Second this one! Kudos to the team!

@episodeyang

This comment has been minimized.

Copy link

episodeyang 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

This comment has been minimized.

Copy link
Member

IgorMinar commented Dec 18, 2015

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

This comment has been minimized.

Copy link

stasberkov commented Dec 29, 2015

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

@masaeedu

This comment has been minimized.

Copy link

masaeedu commented Dec 30, 2015

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

@demurgos

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Member

IgorMinar commented Jan 5, 2016

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 removed this from the beta.02 milestone Jan 26, 2016

@Finkes

This comment has been minimized.

Copy link

Finkes commented Jan 28, 2016

is there anything new to this?

@NikGovorov

This comment has been minimized.

Copy link

NikGovorov commented Jan 29, 2016

@Finkes, still the same for me in beta1.

alexeagle added a commit to alexeagle/angular that referenced this issue Jan 31, 2016

fix(typings): Don't expose typing dependencies to users.
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

This comment has been minimized.

Copy link
Contributor

alexeagle commented Jan 31, 2016

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

fix(typings): Don't expose typing dependencies to users.
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

fix(typings): Don't expose typing dependencies to users.
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

fix(typings): Don't expose typing dependencies to users.
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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Contributor

alexeagle commented Feb 4, 2016

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

fix(typings): Don't expose typing dependencies to users.
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

fix(typings): Don't expose typing dependencies to users.
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

fix(typings): Don't expose typing dependencies to users.
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

fix(typings): Don't expose typing dependencies to users.
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

fix(typings): Don't expose typing dependencies to users.
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

fix(typings): Don't expose typing dependencies to users.
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

fix(typings): Don't expose typing dependencies to users.
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 in 2a70f4e Feb 4, 2016

jesperronn added a commit to jesperronn/angular2-seed that referenced this issue Feb 11, 2016

No reason to remove angular ambient typings, since beta.5 changed this.
Now it's our own responsibility to include peer dependencies and typings for them

See https://github.com/angular/angular/blob/master/CHANGELOG.md#200-beta5-2016-02-10 (breaking changes)

I expect this to fix mgechev#462

Further info about the decision in
* angular/angular#6267
* angular/angular#5973
* angular/angular#5807
* angular/angular#6266
* angular/angular#5242
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment