![](/img/trans.png)
[英]VSCode Experimental Support for Decorators Warning When Trying to Create New Module
[英]when creating new module throw Experimental support for decorators error
我正在嘗試在 angular 項目中生成新模塊
ng g module core/employee-applicant --routing=true
並且生成的新模塊引發異常
對裝飾器的實驗性支持是一項可能在未來版本中更改的功能。 在“tsconfig”或“jsconfig”中設置“experimentalDecorators”選項以刪除此警告。
並且在其他模塊中它不會生成該錯誤。
有錯誤的新模塊
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { EmployeeApplicantRoutingModule } from './employee-applicant-routing.module';
@NgModule({
declarations: [],
imports: [
CommonModule,
EmployeeApplicantRoutingModule
]
})
export class --> EmployeeApplicantModule (the error on visual studio code red under line){ }
不會彈出該錯誤的舊模塊
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { AuthRoutingModule } from './auth-routing.module';
import { LoginComponent } from './login/login.component';
import { MaterialModule } from 'src/app/shared/modules/material.module';
import { PipesModule } from 'src/app/pipes-module';
@NgModule({
declarations: [
LoginComponent
],
imports: [
CommonModule,
AuthRoutingModule,
FormsModule,
ReactiveFormsModule,
MaterialModule,
PipesModule,
]
})
export class AuthModule { }
與使用該新模塊生成的路由模塊相同。
對於experimentalDecorators
裝飾器,我將它添加到我項目的每個 tsconfig 文件中
tsconfig.app.json
tsconfig.spec.json
tsconfig.json
tsconfig.base.json
如果有人能告訴我這些文件有什么區別
還有一件事,當我嘗試將它導入到app.module時,它並沒有顯示出來,我認為這是因為那個錯誤
我的 tsconfig.json 中有以下內容,它工作正常
{
"compilerOptions": {
"target": "ES5",
"experimentalDecorators": true
}
}
伙計們,這似乎是視覺工作室代碼中的一個錯誤
我通過編寫整個路徑將其硬導入其他模塊,然后錯誤消失
至少這為我解決了我不知道如何...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.