Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Can not use latest version (1.0.5) with angular 2 setup #248

Closed
okaufmann opened this issue Nov 1, 2016 · 10 comments
Closed

Can not use latest version (1.0.5) with angular 2 setup #248

okaufmann opened this issue Nov 1, 2016 · 10 comments

Comments

@okaufmann
Copy link

Category

[ ] Enhancement

[x] Bug

[ ] Question

Expected / Desired Behavior / Question

If I use pnp-js-core in my angular 2 app (where core-js is a dependency) i can't compile the latest version 1.0.5 anymore. 1.0.4 works if I add typings for microsoft.ajax and whatwg-fetch additionally.

There are several hints that @typings/core-js causes the problem and should be removed:
angular/angular-cli#1908
angular/angular-cli#2106

Observed Behavior

ERROR in [default] C:\projects\test\node_modules\@types\core-js\index.d.ts:21:13
Duplicate identifier 'PropertyKey'.

ERROR in [default] C:\projects\test\node_modules\@types\core-js\index.d.ts:85:4
All declarations of 'name' must have identical modifiers.

ERROR in [default] C:\projects\test\node_modules\@types\core-js\index.d.ts:145:4
Subsequent variable declarations must have the same type.  Variable '[Symbol.unscopables]' must be of type '{ copyWithin: boolean; entries: boolean; fill: boolean; find: boolean; findIndex: boolean; keys: ...', but here has type 'any'.

ERROR in [default] C:\projects\test\node_modules\@types\core-js\index.d.ts:262:4
All declarations of 'flags' must have identical modifiers.

ERROR in [default] C:\projects\test\node_modules\@types\core-js\index.d.ts:276:4
All declarations of 'EPSILON' must have identical modifiers.

ERROR in [default] C:\projects\test\node_modules\@types\core-js\index.d.ts:311:4
All declarations of 'MAX_SAFE_INTEGER' must have identical modifiers.

ERROR in [default] C:\projects\test\node_modules\@types\core-js\index.d.ts:318:4
All declarations of 'MIN_SAFE_INTEGER' must have identical modifiers.

ERROR in [default] C:\projects\test\node_modules\@types\core-js\index.d.ts:457:4
Subsequent variable declarations must have the same type.  Variable '[Symbol.toStringTag]' must be of type '"Symbol"', but here has type 'string'.

ERROR in [default] C:\projects\test\node_modules\@types\core-js\index.d.ts:457:4
All declarations of '[Symbol.toStringTag]' must have identical modifiers.

ERROR in [default] C:\projects\test\node_modules\@types\core-js\index.d.ts:464:4
All declarations of 'prototype' must have identical modifiers.

ERROR in [default] C:\projects\test\node_modules\@types\core-js\index.d.ts:492:4
All declarations of 'hasInstance' must have identical modifiers.

ERROR in [default] C:\projects\test\node_modules\@types\core-js\index.d.ts:498:4
All declarations of 'isConcatSpreadable' must have identical modifiers.

ERROR in [default] C:\projects\test\node_modules\@types\core-js\index.d.ts:504:4
All declarations of 'iterator' must have identical modifiers.

ERROR in [default] C:\projects\test\node_modules\@types\core-js\index.d.ts:510:4
All declarations of 'match' must have identical modifiers.

ERROR in [default] C:\projects\test\node_modules\@types\core-js\index.d.ts:516:4
All declarations of 'replace' must have identical modifiers.

ERROR in [default] C:\projects\test\node_modules\@types\core-js\index.d.ts:522:4
All declarations of 'search' must have identical modifiers.

ERROR in [default] C:\projects\test\node_modules\@types\core-js\index.d.ts:528:4
All declarations of 'species' must have identical modifiers.

ERROR in [default] C:\projects\test\node_modules\@types\core-js\index.d.ts:534:4
All declarations of 'split' must have identical modifiers.

ERROR in [default] C:\projects\test\node_modules\@types\core-js\index.d.ts:540:4
All declarations of 'toPrimitive' must have identical modifiers.

ERROR in [default] C:\projects\test\node_modules\@types\core-js\index.d.ts:546:4
All declarations of 'toStringTag' must have identical modifiers.

ERROR in [default] C:\projects\test\node_modules\@types\core-js\index.d.ts:552:4
All declarations of 'unscopables' must have identical modifiers.

ERROR in [default] C:\projects\test\node_modules\@types\core-js\index.d.ts:609:4
Subsequent variable declarations must have the same type.  Variable '[Symbol.toStringTag]' must be of type '"Math"', but here has type 'string'.

ERROR in [default] C:\projects\test\node_modules\@types\core-js\index.d.ts:609:4
All declarations of '[Symbol.toStringTag]' must have identical modifiers.

ERROR in [default] C:\projects\test\node_modules\@types\core-js\index.d.ts:613:4
Subsequent variable declarations must have the same type.  Variable '[Symbol.toStringTag]' must be of type '"JSON"', but here has type 'string'.

ERROR in [default] C:\projects\test\node_modules\@types\core-js\index.d.ts:613:4
All declarations of '[Symbol.toStringTag]' must have identical modifiers.

ERROR in [default] C:\projects\test\node_modules\@types\core-js\index.d.ts:628:4
All declarations of 'size' must have identical modifiers.

ERROR in [default] C:\projects\test\node_modules\@types\core-js\index.d.ts:634:4
All declarations of 'prototype' must have identical modifiers.

ERROR in [default] C:\projects\test\node_modules\@types\core-js\index.d.ts:645:4
All declarations of 'size' must have identical modifiers.

ERROR in [default] C:\projects\test\node_modules\@types\core-js\index.d.ts:651:4
All declarations of 'prototype' must have identical modifiers.

ERROR in [default] C:\projects\test\node_modules\@types\core-js\index.d.ts:666:4
All declarations of 'prototype' must have identical modifiers.

ERROR in [default] C:\projects\test\node_modules\@types\core-js\index.d.ts:680:4
All declarations of 'prototype' must have identical modifiers.

ERROR in [default] C:\projects\test\node_modules\@types\core-js\index.d.ts:692:4
All declarations of 'value' must have identical modifiers.

ERROR in [default] C:\projects\test\node_modules\@types\core-js\index.d.ts:804:4
All declarations of 'prototype' must have identical modifiers.

Steps to Reproduce

@patrick-rodgers
Copy link
Contributor

The issue is that if you include 1.0.5 in a non-angular project and remove @types/corejs you get errors on build. So I am not convinced that the 100% correct answer is to remove it as a dependency. I'll take a look at this a little deeper but seems to be caused by decisions made in the angular project.

@patrick-rodgers
Copy link
Contributor

Turns out I can't duplicate this. I followed the steps in the article you linked and create a project with all the files, npm install, ran it and everything worked (I could look at the web page with the logo). Then I

npm install sp-pnp-js --save

Updated the app.component.ts and app.component.html to put a random string on the page using the pnp.util.getRandomString method. webpack bundle auto updated with file save and the page refreshed showing my string. Was also able to build using npm run build as described in the article.

I am using npm version 3.10.8 if that has any effect.

@patrick-rodgers
Copy link
Contributor

@okaufmann - were you able to retest this or provide any additional details? If not I'll be closing this as unable to reproduce. Thanks!

@patrick-rodgers
Copy link
Contributor

Going to close this as unable to reproduce, please do reopen if you can provide additional details. Thanks!

@Abrissirba
Copy link
Contributor

Abrissirba commented Nov 11, 2016

I'm getting this error too after upgrading from 1.0.4 to 1.0.6. Will investigate more and come back

Edit
I had a look and I'm not able to solve this unfortunatly :(

@patrick-rodgers
Copy link
Contributor

I'll go ahead and reopen this, but if someone could please give me the additional steps to duplicate it? I followed what was in the article linked above and did not have issues. Are you installing other libraries? What specific actions are you taking with the library? What changes have you made to the default angular project as outlined in the article?

@patrick-rodgers
Copy link
Contributor

Just an update, still researching. I've removed core-js locally for myself and added es6-promise but an stuck on fetch typings file referencing es6 types when it isn't needed, as discussed here. So hoping that gets resolved and unblocks us. I don't really want to add a shim file to cover those types but might have to as a stop gap.

That being said, I still haven't been able to duplicate the above issue so somewhat guessing this will help.

@ghost
Copy link

ghost commented Nov 22, 2016

I just found out that there was the following config section present in our tsconfig.js but not in the angular-webpack-tutorial ones:

"lib": [
      "dom",
      "es6"
    ]

When this was removed, it works. (This was introduced by typescript 2.0)

Can you proof this @Abrissirba ?

@Abrissirba
Copy link
Contributor

Same for me, when I removed the "lib" property from tsconfig the errors disappears :) Do you have any more information/links about why is this is happening in typescript 2.0 @oka-garaio?

@ghost
Copy link

ghost commented Nov 30, 2016

The lib option is a new feature in ts 2.0. It controlls, which libraries should be included into the compilation. As far as I can see, does angular 2.0 with his own way by including es6 directly via typings (https://github.com/oka-garaio/angular-with-webpack/blob/master/src/polyfills.ts#L1).

This then cause the dublicate type definitions.

Discussion in the Typescript repo: microsoft/TypeScript#6974

As this is no pnp-js-core bug, this issue can be closed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants