[英]Visual Studio 2017 Javascript How to set 'experimentaldecorators'
[英]Visual Studio Code 'experimentalDecorators' Issue for Angular Build
我在VSC上遇到问题,我的所有打字稿类都触发了智能感知并提出以下警告:
“ [ts]的实验性支持是一项功能,该功能在将来的版本中可能会更改。设置'experimentalDecorators'选项可删除此警告。”
这是一个已记录的问题,这些帖子中记录了各种修复程序:
但是,我使用的是VSC的最新版本(实际上是我今天对其进行了更新,似乎已经引起了某些问题),因此此处提到的解决方案似乎都无效。
我有:
这是我当前的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中的TS版本设置为“ 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属性,而不是使用files属性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.