简体   繁体   English

Class 正在使用 Angular 功能但未使用 Typescript 4.8.2 进行装饰

[英]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.

相关问题 Class 正在使用 Angular 功能,但未在 angular 14 中进行修饰 - Class is using Angular features but is not decorated in angular 14 Angular 11 '错误 NG2007:Class 正在使用 Angular 功能但未修饰。 但是 class 是装饰的 - Angular 11 'error NG2007: Class is using Angular features but is not decorated.' But the class is Decorated 问:Angular 组件损坏 - “类正在使用 Angular 功能但未装饰。请添加显式 Angular 装饰器” - Q: Angular components broken - "Class is using Angular features but is not decorated. Please add an explicit Angular decorator" Angular 15: Class 正在使用 Angular 功能但未修饰。 请添加明确的 Angular 装饰器。(-992007) - Angular 15 : Class is using Angular features but is not decorated. Please add an explicit Angular decorator.(-992007) 类使用 Angular 特性但没有修饰。 请添加一个显式的 Angular 装饰器 - Class is using Angular features but is not decorated. Please add an explicit Angular decorator 如何在不出错的情况下实现 OnInit:Class 正在使用 Angular 功能但未进行装饰。 请添加显式 Angular 装饰器 - How do I implement OnInit without getting error: Class is using Angular features but is not decorated. Please add an explicit Angular decorator Angular 库基础 class 没有任何装饰器但使用 Angular 功能 - Angular Library base class without any decorator but using Angular features 使用HttpClient Angular将JSON映射到TypeScript类 - Map JSON to TypeScript Class using HttpClient Angular “......用可注射装饰” - Angular2 - "...decorated with Injectable" - Angular2 Angular TypeScript类实例 - Angular TypeScript class instance
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM