【问题标题】:VS 2017 Error TS1219VS 2017 错误 TS1219
【发布时间】:2018-10-07 02:41:57
【问题描述】:

更改我的 UI 项目的架构后,我遇到了很多错误(TS1219 和 TS2304)。原因是配置 tsconfig.json 不好?还是其他原因? 如果我从项目中删除装饰器,一切都很好,但我需要它们。 我使用 Visual Studio 2017、ASP.CORE 2.1 模板来实现 Angular 5。

错误 TS1219 (TS) 对装饰器的实验性支持是一项可能会在未来版本中更改的功能。设置“experimentalDecorators”选项以删除此警告。

tsconfig.json:

    {
  "compileOnSave": false,
  "compilerOptions": {
    "declaration": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [
      "es2017",
      "dom"
    ],
    "moduleResolution": "node",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ]
  }
}

如果您需要更多信息,请告诉我。

UPD:app.module 中的@NgModule 错误不会出现 当我将带有装饰器的 ts 文件包装到文件夹中时,会出现错误。 它不适用于深度较大的文件吗?

您可以在我的bitbucket(BooksRework branch) 上看到文件夹树。

【问题讨论】:

  • 问题仍然相关

标签: json visual-studio typescript webpack configuration


【解决方案1】:

检查导致错误的*.ts 文件的Build Action 值。应该是None,而不是TypeScript File

【讨论】:

  • 谢谢,这个答案为我解决了。我使用 Visual Studio 添加自动设置 Build Action 的“TypeScript 文件”。将其切换回 None(就像我的其他 TypeScript 文件一样)解决了错误。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多