docs: use `ValidationErrors` interface in Form validation examples (#42135)

PR Close #42135
This commit is contained in:
Sam Severance 2021-05-17 13:50:29 -04:00 committed by atscott
parent 4579200c7f
commit 63383c186d
1 changed files with 1 additions and 1 deletions

View File

@ -5,7 +5,7 @@ import { AbstractControl, NG_VALIDATORS, ValidationErrors, Validator, ValidatorF
// #docregion custom-validator
/** A hero's name can't match the given regular expression */
export function forbiddenNameValidator(nameRe: RegExp): ValidatorFn {
return (control: AbstractControl): {[key: string]: any} | null => {
return (control: AbstractControl): ValidationErrors | null => {
const forbidden = nameRe.test(control.value);
return forbidden ? {forbiddenName: {value: control.value}} : null;
};