我有
对装饰器的实验性支持是一个在将来的版本中可能会发生变化的功能.设置'experimentalDecorators'选项`以删除此警告.
甚至我在tsconfig.json中的compilerOptions都有设置:
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
Run Code Online (Sandbox Code Playgroud)
有些奇怪的是,一些使用装饰器的随机类没有显示出警告,但在同一个项目中却没有.
什么可能导致TypeScript编译器的这种行为?
我可以设置相对于我的项目dir/tsconfig文件的typescript.tsdk吗?看起来此选项仅适用于绝对路径.
我刚从github克隆angular2-seed项目并按照步骤进行操作,但是我在VS代码中得到了这个警告[ts]对装饰器的实验支持是一个在将来的版本中可能会发生变化的功能.设置'Exxperimentaldecorators'选项以删除此警告.
基本上,我遵循了 VSCode: Is it possible to subpressexperimentaldecorator warnings以便取出此类消息,但没有产生任何效果。
首先,我收到这样的消息:
“(节点:15077)DeprecationWarning:node --debug 已弃用。请改用node --inspect”。我在某处读到在 launch.json 中添加 "protocol": "auto" (老实说,我不知道我设置了什么自动)。
它更改了本主题中提到的警告。好吧,我已将 jsconfig.json 添加到项目根目录,但似乎没有改变任何内容。
我不知道它是否相关,但我注意到 Visual Studio Code About 指向 Node 6.5.0,而我的本地节点是 7.7.4。
最后但并非最不重要的一点是,这样的警告意味着什么?
启动.json
{
// Use IntelliSense to learn about possible Node.js debug attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceRoot}/server.js",
"protocol": "auto"
},
{
"type": "node",
"request": "attach", …Run Code Online (Sandbox Code Playgroud) 我正在研究Angular2-Typescript应用程序.我用angular-cli生成了如下项目:
ng new myApp
Run Code Online (Sandbox Code Playgroud)
但是当我创建一个新组件时,@ Component标签上会出现一个警告.
我试着在这篇文章后解决:
但对我不起作用.
我附上我的tsconfig.json:
{
"compilerOptions": {
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["es6", "dom"],
"mapRoot": "./",
"module": "es6",
"moduleResolution": "node",
"outDir": "../dist/out-tsc",
"sourceMap": true,
"target": "es6",
"typeRoots": [
"../node_modules/@types"
]
}
}
Run Code Online (Sandbox Code Playgroud)
打字稿版本是:"打字稿":"2.0.2"