Miomir Dancevic
Miomir Dancevic

Reputation: 6852

FormControl type angular typescript

I have something like this

  get formControls(): any {
    return this.form.controls;
  }

But now I have a problem with tslint. It returns the error Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type. Does anybody knows what type does this.form.controls return? I have tried FormGroup, FormControl, but none was correct.

Upvotes: 0

Views: 312

Answers (1)

Stavm
Stavm

Reputation: 8131

  get formControls(): { [key: string]: AbstractControl } {
    return this.form.controls;
  }

A collection of child controls. The key for each child is the name under which it is registered.

https://angular.io/api/forms/FormGroup#controls

Upvotes: 2

Related Questions