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

Error on $ in angular-protractor.d.ts #4725

Closed
basvandenheuvel opened this issue Oct 14, 2015 · 10 comments
Closed

Error on $ in angular-protractor.d.ts #4725

basvandenheuvel opened this issue Oct 14, 2015 · 10 comments

Comments

@basvandenheuvel
Copy link

Hi,

I'm getting an error on

declare var $: cssSelectorHelper; 

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.

@jessegood
Copy link

@basvandenheuvel : See #4507. Sorry I don't know the solution for Visual Studio though.

@basvandenheuvel
Copy link
Author

Thanks, I indeed wasn't able to solve this problem in VS. I just commented the line in the .d.ts file...

@mhevery mhevery closed this as completed Oct 16, 2015
@DennisRoam
Copy link

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
Copy link
Author

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

+1 I did the hack that @basvandenheuvel said

@vladimir-ivanov
Copy link

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

devcube commented 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
Copy link

I had the same issue with $.
I downloaded beta2 of angular2, and it worked fine.

@tonyeung
Copy link

@vladimir-ivanov's solution works

@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 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants