ERROR in C:/dev/AppName/AppName-Client/src/app/shared/utils/form-helper.ts (3,21): Property 'setValueAndErrors' does not exist on type 'FormGroup'.推荐答案以下为我编译:declare module "@angular/forms/src/model" { interface FormGroup { setValueAndErrors(this: FormGroup, state: any, memberErrors: any): void; }}FormGroup.prototype.setValueAndErrors = function(this: FormGroup, state: any, memberErrors: any): void { this.setValue(state);}键似乎使用的模块名称是指包含FormGroup的实际模块/文件.The key seems to be using the module name that refers to the actual module/file that contains the FormGroup.此外,您将需要解决this的用法.Also, you will need to address your usage of this. 这篇关于无法将新方法添加到Angular TypeScript类(FormGroup)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-23 10:57