angular - 如何摆脱 Eclipse 中 angular4 项目的 experimentalDecorators 警告

标签 angular typescript

我刚刚使用 anglar4 cli 创建了一个新项目,并开始出现以下错误。

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

对于每个注释。

我之前没有使用过 ng cli,所以我没有看到任何类似的警告。

我检查我的 tsconfig,

{
  "compileOnSave": false,
  "compilerOptions": {
    "outDir": "./dist/out-tsc",
    "baseUrl": "src",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "module": "commonjs",
    "noImplicitAny": false,
    "suppressImplicitAnyIndexErrors": true,
    "typeRoots": [
      "node_modules/@types"
    ],

    "exclude": 
    [
        "node_modules",
        "**/*.spec.ts"
    ],

    "lib": [
      "es2016",
      "dom"
    ]
  }
}

没什么特别的。

如何在 Eclipse 中删除 angular4 项目的警告?这是非常烦人的误报。

我在 Eclipse 中使用了 typescript 插件。

最佳答案

I faced similar problem & Adding "allowJs": true, in the CompilerOptions in tsconfig.json solved the issue. I hope it helps others.

添加上面后我的 tsconfig.json 如下所示。

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

关于angular - 如何摆脱 Eclipse 中 angular4 项目的 experimentalDecorators 警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44617664/

相关文章:

javascript - 如何将 Angular 类名称从 component.ts 传递到 html SVG

angular - 是否可以使用 ng-content 将 mat-options 传递给我的自定义 mat-select 组件?

typescript - 如何让 toastr 在 Typescript 中工作

javascript - Elasticsearch-模糊搜索未给出建议

angular - Angular 中的 Mock vs Spy

javascript - AngularJS 服务注入(inject)器错误

angular - 空注入(inject)器错误 : No provider for ReducerManager

java - 错误类型错误: Cannot set property 'name' of undefined

node.js - 在 Angular (>= 2) 应用程序中,如何将 npm package.json 文件中的版本信息包含到编译的输出文件中?

html - CSS 转换出现不需要的行为