【问题标题】:VSCode Experimental Support for Decorators Warning When Trying to Create New ModuleVSCode 尝试创建新模块时对装饰器的实验性支持警告
【发布时间】:2020-11-07 16:41:58
【问题描述】:

我刚刚安装了 Angular 10 并将 VSCode 升级到了最新版本。

创建新模块时:

import { NgModule } from '@angular/core';

const mm = []

@NgModule({
    imports: [ ...mm ],
    exports: [...mm
    ],
    providers: [     
    ]
})
export class MaterialModule {

}

创建此装饰器错误:

class MaterialModule
Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning.ts(1219)

而且它只是为新模块创建的。现有的app.module.ts 没有错误……所以有点混乱。

想法?

【问题讨论】:

    标签: javascript angular typescript visual-studio-code


    【解决方案1】:

    在您的 tslint.config 中添加此行以避免出现此 lint 错误。

    “实验装饰器”:真

    并且还检查了 Visual Studio 设置中的启用实验性装饰器选项,如下面

    希望它会有所帮助。

    【讨论】:

      【解决方案2】:

      我在 VSCode 中卸载并重新安装了“Angular Language Support”,然后就成功了。

      【讨论】:

        猜你喜欢
        • 2020-11-04
        • 2020-11-08
        • 2017-02-08
        • 1970-01-01
        • 2015-10-22
        • 2018-04-05
        • 2017-05-25
        • 2016-11-11
        • 2018-01-16
        相关资源
        最近更新 更多