@internal
(
controls: T | FormControlState<T> | ControlConfig<T> | FormControl<T> | AbstractControl<T>,
)
| 420 | |
| 421 | /** @internal */ |
| 422 | _createControl<T>( |
| 423 | controls: T | FormControlState<T> | ControlConfig<T> | FormControl<T> | AbstractControl<T>, |
| 424 | ): FormControl<T> | FormControl<T | null> | AbstractControl<T> { |
| 425 | if (controls instanceof FormControl) { |
| 426 | return controls as FormControl<T>; |
| 427 | } else if (controls instanceof AbstractControl) { |
| 428 | // A control; just return it |
| 429 | return controls; |
| 430 | } else if (Array.isArray(controls)) { |
| 431 | // ControlConfig Tuple |
| 432 | const value: T | FormControlState<T> = controls[0]; |
| 433 | const validator: ValidatorFn | ValidatorFn[] | null = |
| 434 | controls.length > 1 ? controls[1]! : null; |
| 435 | const asyncValidator: AsyncValidatorFn | AsyncValidatorFn[] | null = |
| 436 | controls.length > 2 ? controls[2]! : null; |
| 437 | return this.control<T>(value, validator, asyncValidator); |
| 438 | } else { |
| 439 | // T or FormControlState<T> |
| 440 | return this.control<T>(controls); |
| 441 | } |
| 442 | } |
| 443 | } |
| 444 | |
| 445 | /** |
no test coverage detected