experimental support for decorators visual studio 2017

LearningPal picture LearningPal · Aug 18, 2018 · Viewed 9.6k times · Source

I have created a .Net Core project with AngularJS in Visual Studio 2017 however when I am trying to create a service, I am getting an error as

Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option `to remove this warning.

I have checked several links such as editing tsconfig.json following links such as link1 and link2

Now my tsconfig.json looks like below

    {
  "compileOnSave": false,
  "compilerOptions": {
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "experimentalDecorators": true,
    "allowJs": true,
    "noEmit": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2017",
      "dom"
    ]
  },
  "include": [
    "app/**/*"
  ],
  "files": [], //add a "files" array (in my case empty)
  "exclude": [
    "node_modules"
  ],
  "typeAcquisition": {
    "enable": true // helps fuel better js intellisense
  }
}

But I still see the error and I am clueless now.

enter image description here

Answer

Haiku picture Haiku · Aug 20, 2018

add

<PropertyGroup>
<TypeScriptExperimentalDecorators>true</TypeScriptExperimentalDecorators></PropertyGroup>

in .csproj file of your project as it will be given precedence over tsconfig.json file and the restart visual studio and the error is no longer there.