[英]Class is using Angular features but is not decorated in angular 14
[英]Class is using Angular features but is not decorated with Typescript 4.8.2
自从我将 Typescript 升级到 4.8.2 以来,我在 Angular 上的所有组件上都出现了“类正在使用 Angular 功能但未装饰”错误。
此错误显示在每个组件的导出 class 名称上。
有没有人遇到过同样的问题?
@Component({
selector: "app-members",
templateUrl: "./members.component.html",
styleUrls: ["./members.component.scss"]
})
export class MembersComponent implements OnInit {...
在此示例中,“MembersComponent”会引发错误。
我的 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
}
}
我遇到了完全相同的问题,代码仍然可以编译和运行,但现在我已将 typescript 降级到 4.7.4,防止编辑器中出现恼人的错误.. 并留意高于 4.8.2 的下一个版本看看有没有修复
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.