Using TypeScript decorators caused errors

I am using TypeScript in a new ASP.NET project project.

We actively use decorators .

Unfortunately, this causes a lot of errors in the output of VS2015:

Error TS1219 Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning. WebApplication2 d:\documents\visual studio 2015\Projects\WebApplication2\src\WebApplication2\wwwroot\sources\app.ts 9 Active 

It is quite simple to get rid of these error messages in regular ASP.NET projects by modifying the *.csproj file.

But the ASP.NET Core project does not use .csproj , instead it uses .xproj .

So, how to enable support for TypeScript experimenters in VS2015 in an ASP.NET Core project?


You can find the simplest project that reproduces the problem in the github rep example

+5
source share
1 answer
  • Right click on your project> Add > New Item .
  • Select Client-side from the left hand menu.
  • Add a new TypeScript JSON Configuration File . Leave it as the default name tsconfig.json .
  • Open tsconfig.json . In the complierOptions section, add "experimentalDecorators": true .
  • Remove "wwwroot" from the "exclude" section.
  • Build and enjoy.

Here is my tsconfig.json file for completeness:

 { "compilerOptions": { "noImplicitAny": false, "noEmitOnError": true, "removeComments": false, "sourceMap": true, "target": "es5", "experimentalDecorators": true }, "exclude": [ "node_modules" ] } 
+3
source

Source: https://habr.com/ru/post/1243231/


All Articles