How to resolve Errors after adding jquery.d.ts to project - visual-studio-2013

In Visual Studio, I create an default TypeScript site.
I then use Nuget to add jquery.d.ts.
I then compile the app.
The error window shows me 101 Errors in the jquery.d.ts file such as:
Error 341 ',' expected.
How do I resolve these errors?
Have I incorrectly imported the file, or is there some setting I need to set?
The actual error as shown in the UI says:
A parameterized initializer is only allowed in a function or constructor implementation.
On this line:
replaceAll(target: JQuery|any[]|Element|string): JQuery;

You're probably using an old version of TypeScript compiler. Union types (that is JQuery|any[]|Element|string) are only available since TypeScript 1.4
Try updating TypeScript for Visual Studio.

Related

TypeScript Duplicate errors after upgrading to VS 15.5.4

I was previously on Visual Studio 2017 15.1 and had no errors at all. The project is building fine, all of the errors are coming from Intellisense.
I have DefinitelyTyped definition files in my project.
The errors I'm receiving include
Duplicate string index signature (JQueryUI)
Duplicate identifier on export = jQuery (JQuery)
Cannot redeclare blockscoped variable 'jQuery' (JQuery)
Cannot redeclare blockscoped variable '$' (JQuery)
Duplicate identifier (project namespace)
Cannot find namespace (project namespace)
This is in a .NET Core project with TypeScript 2.5. I don't have a tsconfig, the project settings can be seen in the image below:

Visual Studio 2017- prevent typescript errors with asmx files

I installed Visual Studio 2017 community edition. I loaded my project up that has an asmx file. When I compile the project I get a few typescript errors:
> TS1005 ';' expected
> TS1146 Declaration expected
> etc.
When I double-click on the errors it shows me the asmx file which has one line and looks like this:
<%# WebService Language="C#" CodeBehind="AjaxCalls.asmx.cs" Class="Nova.AjaxCalls" %>
Why would typescript give me an error about this line? This is not related to typescript at all. Is Visual Studio showing me the wrong file of where the error is located?
UPDATE :
I found the solution to my problem. I added a reference to my project called Microsoft.CSharp. This fixed the issue. If that reference already exist then try removing it and adding it back. Apparently it has something to do with IntelliSense.
Upgrading the installed typescript nuget package from 1.8 to 2.4 solved it for me.
It's important to note that when saving typescript files VS2017 uses the version of typescript installed on the computer (default 2.4 with VS2017)
But your code could be using an older version of typescript when hitting "build". compared to when hitting ctrl+s, or just looking at errors in the IDE.
This is because typescript as a nuget package (v1.8 for example), adds targets that msbuild uses to compile the typescript when building.
But that is not what the VS2017 IDE uses to show error messages, it uses the newest version installed on the pc.
This mismatch between versions could be what is causing issues. showing errors but not failing to ctrl+s compile / msbuild build.
Try installing/uninstalling typescript nuget package and check up on which version is installed locally on the pc and if the project itself has a nuget package with a corresponding version or not.

Visual Studio 2013 with Angular2 and Typescript

I'm using the angular2 QUICKSTART and I have a problem where Visual Studio don't recognize Angular2 with typescript import Modules, in rest all it's fine:
It says:
Cannot find module 'angular2/platform/browser'
My app :
is compiling .ts files without errors
it runs in browser without errors
if I open the project in VS code it works fine, no errors in IDE
I know that typescript should read .d.ts file directly from node_modules --> angular2, but anyway I tried to add angular2 DefinitelyTyped and still not worked.
Atm I use VS 2013 update 5 with typescript 1.5 installed (I also tried with 1.75)
Please right click on the visual studio project and click on the Properties option, Then select Typescript Build,default 'none' is selected, change it to 'CommonJs'.
If again any problem regarding 'experimentalDecorators' persists unload the project and add <TypeScriptExperimentalDecorators>true</TypeScriptExperimentalDecorators>statement inside the PropertyGroup tag.
Again problem exists on building the project such as 'could not find the name Map', 'could not find the name Promise', or 'could not find the name Set' try to change the target to 'es6' in the tsconfig.json
Solved by using Visual Studio 2015.

Xamarin and ClosedXML

I have some C# code which was originally written in Visual Studio.
I am now trying to make this code run in a Mac, using the Xamarin Studio.
I get multiple errors, that have to do with the references:
For example, the original code uses a library which is called "ClosedXML".
I get an error "The type or namespace nameClosedXML' could not be found. Are you missing an assembly reference?"`
I get such errors on many occasions, for different libraries.
Any way to solve this? Thanks in advance
For each of the The type or namespace name xxx could not be found error, you have to reference the associated assemblies.
For example, you have to add ClosedXML.dll to resolve ClosedXML namespace. It can be done via Nuget -
PM> Install-Package ClosedXML
Or directly downloading and referencing the DLL from here

How to solve this error: Could not find file 'Microsoft.Windows.CommonLanguageRuntime, Version 2.0.50727.0'

This question to which I already found the answer is posted here in case of someone else encounters it. I decided to post the Q&A here so that SO has something about this error, since I don't know if it's been here before.
This occured after an update of the .NET Framework. Before the update, everything compiled just fine! After the update, I could compile nothing!
The error message is:
Error 1 - Could not find file 'Microsoft.Windows.CommonLanguageRuntime, Version=2.0.50727.0'.
This is a problem within Visual Studio 2005. This occurs after an update of the .NET Framework 2.0 and is due to project reference within a single solution.
For example, when you're writing a test library which will test your assembly within the same solution, you will most likely reference the project. Then, this error may occur.
To solve this error, simply reference the file binary of your project, either the DLL or the EXE within which resides the code you want to test. This is called a file reference.
Let's suppose we have two projects called:
Company.Project.ApplicationName;
Company.Project.ApplicationName.Tests.
When adding the reference to our Company.Project.ApplicationName project within our Company.Project.Application.Tests project, we can either use the Browse or the Project tab. When using the Project tab, you create a project reference. We don't want to use this if this error occurs. What we want to use is Browse, so that we can make a file reference.
Here's a link to the Microsoft Support Website that explains this issue.
You may receive a "Could not find file 'Microsoft.Windows.CommonLanguageRuntime" error message when you build a solution of a Visual Basic 2005 Windows Application project in Visual Studio 2005

Resources