import { Injectable } from '@angular/core';
import { AbstractControl, AbstractControlOptions, AsyncValidatorFn, FormBuilder, FormControlOptions, FormControlState, ValidatorFn } from '@angular/forms';

@Injectable()
export class CustomFormBuilder extends FormBuilder {
  constructor() {
    super();
  }

  ctr<T>(formState: T | FormControlState<T>, validatorOrOpts?: ValidatorFn | ValidatorFn[] | FormControlOptions | null, asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null): AbstractControl {
    return super.control(formState, validatorOrOpts, asyncValidator) as AbstractControl;
  }

  arr<T>(controls: Array<T>, validatorOrOpts?: ValidatorFn | ValidatorFn[] | AbstractControlOptions | null, asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null): AbstractControl {
    return super.array(controls, validatorOrOpts, asyncValidator) as AbstractControl;
  }
}
