Roimer
Roimer

Reputation: 1459

Javascript await/async keywords shows error in Visual Studio 2015

When writing Javascript in a Web application in Visual Studio 2015, the async and await keywords are marked as error. For example:

const response = await fetch(url, options);

This is how it looks like in VS2015:

Syntax Errro of await keyword in VS2015

Here, await is marked in red indicating a syntax error. This happens in Javascript files and in script elements in html or ASPX pages. All code actually works: I've been succesfully using async/await for a few months so far. The only problem is that Visual Studio formating/code collapsing fails because of the "error", and always show the annoying red marks.

I tried tweaking some TypeScript options (I even updated Typescript support), but we are using Javascript heavily (migrating to TypeScript is not an option), so it probably wont work anyway. I found out that I can add "javascript reference files" to visual studio (Options > Javascript > Intellisense), but couldn't find a proper reference to add support for async/await, and probably others newer javascript caracteristicts.

Right now I can't get a newer version of Visual Studio (I'm one of many developers in the same project).

Additional info: This is a web application project (It is an ~8yo project in continuous development). Mostly ASP.NEt + VB.NET, there is a lot of client side Javascript (both vanilla and jQuery) executed only in Browser (no NodeJS).

Upvotes: 1

Views: 673

Answers (0)

Related Questions