You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to compile a TypeScript file that imports something from angular2 (2.0.0-alpha.46) and also references the TSD type definitions for jQuery, I get the following error from the TypeScript compiler:
node_modules/angular2/typings/angular-protractor/angular-protractor.d.ts(1679,13): error TS2403:
Subsequent variable declarations must have the same type. Variable '$' must be of type
'JQueryStatic', but here has type 'cssSelectorHelper'.
The app itself doe not refer to Protractor in any way. The types are pulled in by Angular 2 internally, it seems.
Use case: Running a hybrid Angular 1+2 app during upgrade. The Angular 1 type definitions from TSD also pull in jQuery type definitions, and I suspect they'll be commonly used during upgrades.
@episodeyang Those typings are not in the registry. If you would like to create them and contribute them to the registry, you're welcome to! You should have seen this message when you tried to use it:
➜ typings git:(master) typings i angular -S
TypeError: Unable to find "angular" from "npm" in the registry. If you can contribute this typing, please help us out - https://github.com/typings/registry
I had the same problem when i upgrade angular. We do not use angular-protractor.d.ts, but it has been added in there when import as angular/angular. Is angular-protractor compulsory?
I tried to comment angular-protractor.d.ts out which also fix this problem. That would not be a solution, because it is a part of package.
@laco0416 you should switch to typings. I recommend deleing the types in the angular2 repo and manage it with typings outside. You should also have a config for each environment. For an example see angular/universal-starter@cfb7b52
I believe this is fixed. Note that angular-protractor.d.ts and jquery.d.ts still conflict on the definition of $, see DefinitelyTyped/DefinitelyTyped#2734
Activity
dsebastien commentedon Nov 24, 2015
There's a common theme here: #5395 :)
ericmartinezr commentedon Nov 24, 2015
There's another issue related #4725
PatrickJS commentedon Nov 24, 2015
typings fixes this (the TSD replacement)
related The State of Typescript Packages
dsebastien commentedon Nov 24, 2015
Thanks for the links @gdi2290, I'll check that out! There's indeed still room for improvement in TS typings land ;-)
geyang commentedon Nov 25, 2015
@gdi2290 I tried to install jquery and angular2 using typings. DId this just came out today?
blakeembrey commentedon Nov 25, 2015
@episodeyang Those typings are not in the registry. If you would like to create them and contribute them to the registry, you're welcome to! You should have seen this message when you tried to use it:
yizhan commentedon Dec 4, 2015
I had the same problem when i upgrade angular. We do not use angular-protractor.d.ts, but it has been added in there when import as angular/angular. Is angular-protractor compulsory?
I tried to comment angular-protractor.d.ts out which also fix this problem. That would not be a solution, because it is a part of package.
In the end, I have to commented
geyang commentedon Dec 4, 2015
Hi, this problem still persists in alpha.47.
demurgos commentedon Dec 10, 2015
Thank you @gdi2290,
typingsseems really promising. It would be great if angular's definition would not leak as described in the article.lacolaco commentedon Jan 2, 2016
I have the same problem in angular2-beta.0 and angularjs-1.4.8
lacolaco commentedon Jan 21, 2016
@IgorMinar Hi, what do you think this? Due to this, I cannot do a migration from ng1 to ng2.
PatrickJS commentedon Jan 21, 2016
@laco0416 you should switch to
typings. I recommend deleing the types in the angular2 repo and manage it withtypingsoutside. You should also have a config for each environment. For an example see angular/universal-starter@cfb7b52IgorMinar commentedon Jan 22, 2016
We are working on resolving this. Part of the solution landed already:
#6262
The final part of the solution is in works now.
On Wed, Jan 20, 2016 at 8:40 PM PatrickJS [email protected] wrote:
NikGovorov commentedon Jan 29, 2016
It works in beta2.
alexeagle commentedon Feb 12, 2016
I believe this is fixed. Note that angular-protractor.d.ts and jquery.d.ts still conflict on the definition of
$, see DefinitelyTyped/DefinitelyTyped#2734WIP: Removing angular-protractor typelib as it doesn't appear to be n…
angular-automatic-lock-bot commentedon Sep 8, 2019
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.