refactor(forms): ensure compatibility with typescript strict flag (#30993)
As part of FW-1265, the `@angular/forms` package is made compatible with the TypeScript `--strict` flag. Read more about the strict flag [here](https://www.typescriptlang.org/docs/handbook/compiler-options.html) PR Close #30993
This commit is contained in:
parent
ce9d0de840
commit
221cbd0b47
|
@ -140,12 +140,12 @@ function _throwError(dir: AbstractControlDirective, message: string): void {
|
|||
throw new Error(`${message} ${messageEnd}`);
|
||||
}
|
||||
|
||||
export function composeValidators(validators: Array<Validator|Function>): ValidatorFn|null {
|
||||
export function composeValidators(validators: Array<Validator|ValidatorFn>): ValidatorFn|null {
|
||||
return validators != null ? Validators.compose(validators.map(normalizeValidator)) : null;
|
||||
}
|
||||
|
||||
export function composeAsyncValidators(validators: Array<Validator|Function>): AsyncValidatorFn|
|
||||
null {
|
||||
export function composeAsyncValidators(validators: Array<AsyncValidator|AsyncValidatorFn>):
|
||||
AsyncValidatorFn|null {
|
||||
return validators != null ? Validators.composeAsync(validators.map(normalizeAsyncValidator)) :
|
||||
null;
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ function _find(control: AbstractControl, path: Array<string|number>| string, del
|
|||
}
|
||||
if (path instanceof Array && (path.length === 0)) return null;
|
||||
|
||||
return (<Array<string|number>>path).reduce((v: AbstractControl, name) => {
|
||||
return (<Array<string|number>>path).reduce((v: AbstractControl | null, name) => {
|
||||
if (v instanceof FormGroup) {
|
||||
return v.controls.hasOwnProperty(name as string) ? v.controls[name] : null;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue