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
in the angular-protractor.d.ts of angular alpha 42.
( I just upgraded from .37 to .42, so i don't know if this problem is there since 38.. 39 .. 40...)
I think it conflicts with the jquery.d.ts which exports the $.
I'm using VisualStudio 2015. The error i get is Build: Subsequent variable declarations must have the same type. Variable '$' must be of type 'JQueryStatic', but here has type 'cssSelectorHelper'.
Does anyone have a solution? Commenting the line seems like a workaround but doesn't feel right.
What is the "correct" way around this issue? I'm using the angular2 seed but added jQuery to run third party scripts and I'm hitting this issue. Commenting out is fine for now but is very hacky..
@DennisRoam They closed the issue without giving any kind of solution, sorry. At the moment i just comment the line.... The problem is if you run npm update or npm install, the file is downloaded again and you have to comment the line again. I don't understand why angular would declare a var named $ since thats JQuery's for the past years
as a workaround, since jquery does not distribute a jquery.d.ts file, the file definition of jquery.d.ts could be placed in [source-code-base-dir]/typings/jquery.d.ts
and simply change the bottom lines to:
declare module "jquery" {
export var $:JQueryStatic;
}
//declare var jQuery: JQueryStatic;
//declare var $: JQueryStatic;
or declare a new module as such (a bit hacky):
declare module "jquery" {
export var $:any;
}
and the error will go away (tested with webpack and ts-loader)
I personally think this is not a problem with angular2 d.ts files and more likely incorrect import of jquery.
Reacted by tonyeung, Narain S., Lluis Nieto, Ruben Chavarri, Safeer Hussain and Jesper Rønn-Jensen
Hmm, well I'm not convinced. As @basvandenheuvel said, $ has belonged to jQuery for quite some time. I'm also having this problem and I'm hoping for a more permanent solution than to keep commenting the line in angular2 (or changing the jquery.d.ts file).
Activity
jessegood commentedon Oct 14, 2015
@basvandenheuvel : See #4507. Sorry I don't know the solution for Visual Studio though.
basvandenheuvel commentedon Oct 15, 2015
Thanks, I indeed wasn't able to solve this problem in VS. I just commented the line in the .d.ts file...
DennisRoam commentedon Oct 23, 2015
What is the "correct" way around this issue? I'm using the angular2 seed but added jQuery to run third party scripts and I'm hitting this issue. Commenting out is fine for now but is very hacky..
basvandenheuvel commentedon Oct 23, 2015
@DennisRoam They closed the issue without giving any kind of solution, sorry. At the moment i just comment the line.... The problem is if you run npm update or npm install, the file is downloaded again and you have to comment the line again. I don't understand why angular would declare a var named $ since thats JQuery's for the past years
mbalex99 commentedon Nov 22, 2015
+1 I did the hack that @basvandenheuvel said
vladimir-ivanov commentedon Dec 2, 2015
as a workaround, since jquery does not distribute a jquery.d.ts file, the file definition of jquery.d.ts could be placed in [source-code-base-dir]/typings/jquery.d.ts
and simply change the bottom lines to:
declare module "jquery" {
export var $:JQueryStatic;
}
//declare var jQuery: JQueryStatic;
//declare var $: JQueryStatic;
or declare a new module as such (a bit hacky):
declare module "jquery" {
export var $:any;
}
and the error will go away (tested with webpack and ts-loader)
I personally think this is not a problem with angular2 d.ts files and more likely incorrect import of jquery.
devcube commentedon Dec 10, 2015
Hmm, well I'm not convinced. As @basvandenheuvel said, $ has belonged to jQuery for quite some time. I'm also having this problem and I'm hoping for a more permanent solution than to keep commenting the line in angular2 (or changing the jquery.d.ts file).
htakemoto commentedon Feb 1, 2016
I had the same issue with $.
I downloaded beta2 of angular2, and it worked fine.
tonyeung commentedon Apr 14, 2016
@vladimir-ivanov's solution works
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.