实验室支持装饰工作室视觉工作室2017

Lea*_*Pal 15 typescript typescript2.0 angular asp.net-core-2.1

我在Visual Studio 2017中使用AngularJS创建了一个.Net Core项目,但是当我尝试创建服务时,我收到错误

对装饰器的实验性支持是一个在将来的版本中可能会发生变化的功能.设置'experimentalDecorators'选项`以删除此警告.

我检查了几个链接,例如编辑tsconfig.json以及link1link2等链接

现在我的tsconfig.json如下所示

    {
  "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
  }
}
Run Code Online (Sandbox Code Playgroud)

但我仍然看到错误,现在我一无所知.

在此输入图像描述

小智 27

<PropertyGroup>
<TypeScriptExperimentalDecorators>true</TypeScriptExperimentalDecorators></PropertyGroup>
Run Code Online (Sandbox Code Playgroud)

在项目的.csproj文件中,它将优先于tsconfig.json文件和重新启动visual studio,并且错误不再存在.


Ela*_*r-L 14

同样的问题,这让我发疯。
添加项目的.csproj文件

<ItemGroup>
    <Content Include="ClientApp\tsconfig.json">
      <CopyToOutputDirectory>Never</CopyToOutputDirectory>
    </Content>
  </ItemGroup>
Run Code Online (Sandbox Code Playgroud)

https://github.com/Microsoft/TypeScript/issues/25823