我有一个使用 Angular 4 的应用程序,我尝试使用 jasmine 和 Karma 进行测试。但是却发生了这个错误。
对装饰器的实验性支持是一项可能会发生变化的功能。 future 的版本。设置“experimentalDecorators”选项以删除此警告。
这是我的 tsconfig 文件
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/",
"baseUrl": "./",
"sourceMap": true,
"declaration": true,
"module": "commonjs",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es6",
"dom"
]
},
"angularCompilerOptions": {
"genDir": "aot",
"strictMetadataEmit": true
}
}
我刚刚编辑了 VScode 的 settings.json 并放入了这段代码
"typescript.tsdk": "node_modules\\typescript\\lib"
但没有成功。
最佳答案
如果您不想创建文件 jsconfig.json
或 tsconfig.json
,您只需为所有项目启用 experimentarDecorators在 Visual Studio 代码中:
- 文件 > 首选项 > 设置
- 搜索:experimentalDecorators
- 启用复选框
关于angular - 实验装饰器警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46914749/