[英]Class is using Angular features but is not decorated with Typescript 4.8.2
I'm getting this "Class is using Angular features but is not decorated" error on all my components on Angular since I upgraded Typescript to 4.8.2.自从我将 Typescript 升级到 4.8.2 以来,我在 Angular 上的所有组件上都出现了“类正在使用 Angular 功能但未装饰”错误。
This error shows on the export class name of each component.此错误显示在每个组件的导出 class 名称上。
Has anyone expericenced this same issue?有没有人遇到过同样的问题?
@Component({
selector: "app-members",
templateUrl: "./members.component.html",
styleUrls: ["./members.component.scss"]
})
export class MembersComponent implements OnInit {...
In this example the "MembersComponent" throws the error.在此示例中,“MembersComponent”会引发错误。
My tsconfig.json:我的 tsconfig.json:
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": ".",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"module": "esnext",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"noUnusedLocals": false,
"target": "ES2021",
"forceConsistentCasingInFileNames": true,
"typeRoots": [
"node_modules/@types"
],
"lib": [
"ES2021.String",
"ES2021",
"dom"
]
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"preserveWhitespaces": true,
"strictTemplates": true
}
}
I had the exact same issue, the code still compiles and runs ok, but for now I have downgraded typescript to 4.7.4, ro prevent annoying errors in editor.. and also keeping an eye out for next version higher than 4.8.2 to see if any fix我遇到了完全相同的问题,代码仍然可以编译和运行,但现在我已将 typescript 降级到 4.7.4,防止编辑器中出现恼人的错误.. 并留意高于 4.8.2 的下一个版本看看有没有修复
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.