Angularjs - Resharper intellisense broken with TypeScript? - angularjs

I have VS 2013 Update 4, TS 1.4, latest WebEssentials and R# 8.
I am trying to create some AngularJS code in my MVC solution.
In installed Angularjs and angular.d.ts via nuget. I have done the same for "marked" and also jQuery installed automatically as Angular dependency.
How, none of Angular types get resolved by Intellisense. If I am trying to type "mar" in an empty TypeScript file I get this:
If I type "jque" I get this:
But when I type "ang" - nothing.
All d.ts files are in place:
Adding reference path directive does not help, although it is not required and Intellisense works perfectly fine for other frameworks. Manual typing without Intellisense support works fine and I get no compilation errors, so TSLint and tsc are ok with my code.
So, my question is - what is going on there?
P.S. Just added Knockout to test this and typing "ko" brings proper Intellisense.
P.P.S. I turned off the TS support in R# and intellisense seems to work properly. So, I would assume this is the Resharper issue.

I turned off the TS support in R# and intellisense seems to work properly. So, I would assume this is the Resharper issue
Yes. They need to update for v1.4 of typescript. You can use an older angular.d.ts till then : https://github.com/borisyankov/DefinitelyTyped/blob/1.3.0/angularjs/angular.d.ts

As basart mentioned, rather than installing EAP or turning Resharper off, you can use an older version of the file for the interim period. But I advise against adding it manually in your solution. Version 1.7.4 of jQuery d.ts and version 2.4.0 of Angular d.ts worked for me and you can use NuGet from the Package Manager command line in Visual Studio to install them.
Install-Package jquery.TypeScript.DefinitelyTyped -Version 1.7.4
Install-Package angularjs.TypeScript.DefinitelyTyped -Version 2.4.0
Make sure you select your project in the dropdown box inside the console before running the command.

I had this problem a little earlier today, where inline intellisense was flagging angular, as well as various interfaces (usually IPromise<T>) as not being found, despite having reference metacomments and the files present in my project.
Similar to the answer from #basarat, I was able to disable ReSharper Intellisense (Resharper | Options... | Intellisense | General), restart Visual Studio, and then re-enable TypeScript Intellisense. Upon re-enabling intellisense, I no longer get red squigglies.
I did this in Visual Studio 2015, ReSharper 2016.3.2, on a project that is using Angular 1.6 and TypeScript together, with no tsconfig.json file (configuration is done in the TypeScript tab of the Web project.)

Related

Make VS2017 to understand jsx

VS 2017 is supposed to understand jsx files. When I transitioned from 2015 to 2017, all my jsx files turned into a very long red underline. There where errors everywhere even though in vs2015 i didn't have any errors. I suppose that is because vs 2015 just didn't bother to "intellisense" the files in the first place, but I prefer to have no intellisense and a clean view, than have intellisense that considers everything is wrong.
I use webpack+babel to transpile and bundle my react components. When I buld with webpack everything goes fine. But the intellisense says everything is wrong.
In my web project there is a folder named 'React' under which all my react views and components are located.
When I import 3rd party components (not relative paths) vs 2017 intellisense says it can't find the modules.
But this is not happening to all files. In some files it can resolve the modules, in others it cannot.
What is going on here and how am I supposed to solve this problem?
Intellisense is broken so I had to disable highlighting syntax errors. It's better that way, but still I don't have intellisense (autocompletion, suggestions etc)
You should download react.d.ts file so Visual studio could understand them.
For example download from here: react.d.ts or I think there is a nuget package also.
Another solution is to use this syntax: var react=require('react') but you will not get intellisense this way, but at least you will get successfull build.

How to get AngularJS Intellisense in Visual Studio 2015

I am using VS2015 Enterprise. In which I have created MVC Project and added file named "angular.min.js" downloaded from angularjs.org but Angular intellisense is not working. Although I have referenced this file in my custom javascript file named "AngularScript.js" as shown in figure.
The most easiest way to get intellisense is to install angularjs package from "Manage Nuget Packages" as shown in figure below.
just install this package and this will resolve all your issues regarding intellisense and other. Do this and enjoy the AngularJS intellisense in your application. :-)

DefinitelyTyped TypeScript

im trying to code in typescript using Angular library, and everytime i try to compile just give me 482 errors, where most of them are "TS 2304 Cannot find a name 'Promise'". I canĀ“t fix this. Just a note, if i unistall angular library, it compiles with no error.
I install Angular 1.5, and Angular.d.ts requires Angular 1.4+, so no problem here.
I try to reinstall multiple times, still no changes.
For angular.d.ts i used a nuget package named angularjs.typescript.definitelytyped. Im using visual studio 2015 Update 1, with all the updates available today.
According to Daniel Rosenwasser's comment I added the core-js d.ts with
PM> Install-Package core-js.TypeScript.DefinitelyTyped
That solved the problem for me.

angularjs definitely typed visual studio 2015

I'm trying to get my first angularjs project to work within Visual Studio 2015. Worked fine until I tried to move to Typescript. Installed the DefinitelyTyped projects and get lots of error messages.
Here is how to reproduce it:
Create an empty ASP.NET 4.5.2 application
Nuget AngularJS Core 1.4.4
Nuget AngularJS.TypeScript.DefinitelyTyped 4.1.1 (includes jQuery 0.0.1)
Add an empty TypeScript file
Add
/// <reference path="typings/angularjs/angular.d.ts" />
to that file.
that's when I get 444 errors, starting with
Error TS2411 Property 'find' of type '{ (selector: string):
IAugmentedJQuery; (element: any): IAugmentedJQuery; (obj: JQuery):
IAugment...' is not assignable to string index type 'HTMLElement'.
TypeScript Virtual Projects l:\M\eigene dateien\visual studio
2015\Projects\WebApplication3\WebApplication3\Scripts\typings
\angularjs\angular.d.ts
Any idea what I'm doing wrong or how to work around it?
I checked this package and most of the errors seem to come from the jquery.d.ts file, which just looks old. That file still uses "bool" instead of "boolean", which was a breaking change made long ago.
I fixed it by adding "jQuery.Typescript.DefinitelyTyped" to the project, which upgraded the jQuery.d.ts file to a version that parsed properly. As soon as I did that, all of the compiler errors went away.
This seems like a bug in the nuget package authoring. I'll look into opening an issue on github.
Hope that works for you.
UPDATE: I opened this issue in GitHub https://github.com/borisyankov/DefinitelyTyped/issues/5446
I had the same issue, but the above solution didn't work out for me.
jQuery.Typescript.DefinitelyTyped was already installed as it is required by angularjs.TypeScript.DefinetlyTyped package.
I fixed it by:
uninstall angularjs package.
uninstall angularjs.TypeScript.DefinetlyTyped package.
uninstall jQuery.Typescript.DefinitelyTyped
install jQuery.Typescript.DefinitelyTyped
install angularjs.TypeScript.DefinetlyTyped package.
install angularjs package.
Thanks Michael for supplying the hint.
The issue is caused by NuGet in VS 2015, because it defaults to installing the oldest version of its dependencies which in this case installs ancient jQuery DT package for the AngularJS DT package, as explained here.
I fixed this even simpler by just doing these:
Manage NuGet packages for project
Show only installed packages
Select jquery.TypeScript.DefinitelyTyped
Upgrade
Enjoy!

Build errors in VS13 in angular.d.ts and jquery.d.ts using TypeScript [duplicate]

I have a problem with Visual Studio 2013 generating too many errors when building a web application with typescript definition files. For example consider the following scenario:
Start a new Empty Web Application
Right click on project and select Manage Nuget Packages
Add jquery and jquery typings (the typings I downloaded are a couple of days old)
Build the project
Project builds successfully with more than 100 errors (errors, not warnings), all in jquery.d.ts, like the following:
',' expected.
'=' expected.
Identifier expected.
I get similar results when I do the same with angularjs instead of jquery.
Any ideas?
The most likely reason for this is that you are using an older version of TypeScript than the definition author.
The language is moving swiftly and some of the features in version 1.4 are particularly useful in definition files, so it is likely that you will need to upgrade to 1.4 so that your machine can understand these new features.
Download version 1.4 here.
I was having a similar issues like this but I was able to resolve the jQuery issues by downgrading my DefinitelyTyped version of "1.0.1" instead of "1.4.1". Also I'm currently running on Mac and hopefully this can help users who are experiencing issues on Mac.

Resources