Visual Studio Code 'experimentalDecorators' Issue for Angular Build



我对VSC有一个问题,我的所有打字稿类都在触发IntelliSense并提出此警告:

" [TS]实验支持是一种可能会改变的功能 在未来的构建中。设置"实验授权器"选项以删除 此警告。"

这是一个记录的问题,这些文章中有各种修复:

  • https://github.com/microsoft/typescript/issues/9335
  • 实验装饰器在视觉工作室代码中警告

但是,我正在使用现在越来越最新的VSC版本(实际上我正在更新它似乎已经触发了某些内容(,而此处提到的解决方案似乎都没有起作用。

我有:

  • 在我的.VSCODE设置
  • 在应用程序根部的tsconfig.json文件中删除了各种行,包括lib,baseurl等
  • 在我的软件包中尝试了替代打字稿。JSON
  • 将我的计算机重新启动了

这是我当前的tsconfig.json

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

我正在使用VSC版本2.3.2,并且我的package.json设置为" typescript":" 〜2.2.0"。

这里有我缺少的东西吗?

this is what what worked for me:  
tsconfig.js (relevant part):
{
  "compilerOptions": {
    ...
    "declaration": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "outDir": "dist",
    ...
  },
  "include": [
    "src/index.ts"
  ]
}

这是完整文件:

{
  "compilerOptions": {
    "declaration": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "noImplicitAny": true,
    "strictNullChecks": true,
    "allowJs": true,
    "lib": [
      "es6"
    ],
    "module": "commonjs",
    "moduleResolution": "node",
    "outDir": "dist",
    "sourceMap": true,
    "target": "es6"
  },
  "include": [
    "src/db/**/*.ts",
    "src/index.ts"
  ]
}

基本上,我刚刚添加了include属性而不是使用文件属性。

最新更新