Skip to content

Commit 17dcbf6

Browse files
committed
feat(forms): expose ValidatorFn and AsyncValidatorFn
Closes #8834
1 parent 40b907a commit 17dcbf6

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

modules/@angular/forms/src/forms.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ export {FormControlName} from './directives/reactive_directives/form_control_nam
3838
export {FormGroupDirective} from './directives/reactive_directives/form_group_directive';
3939
export {FormGroupName} from './directives/reactive_directives/form_group_name';
4040
export {NgSelectOption, SelectControlValueAccessor} from './directives/select_control_value_accessor';
41-
export {MaxLengthValidator, MinLengthValidator, PatternValidator, RequiredValidator, Validator} from './directives/validators';
41+
export {AsyncValidatorFn, MaxLengthValidator, MinLengthValidator, PatternValidator, RequiredValidator, Validator, ValidatorFn} from './directives/validators';
4242
export {FormBuilder} from './form_builder';
4343
export {AbstractControl, FormArray, FormControl, FormGroup} from './model';
4444
export {NG_ASYNC_VALIDATORS, NG_VALIDATORS, Validators} from './validators';
45+
4546
export * from './form_providers';

tools/public_api_guard/forms/index.d.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ export declare abstract class AbstractControlDirective {
5858
valueChanges: Observable<any>;
5959
}
6060

61+
export interface AsyncValidatorFn {
62+
(c: AbstractControl): any;
63+
}
64+
6165
export declare class CheckboxControlValueAccessor implements ControlValueAccessor {
6266
onChange: (_: any) => void;
6367
onTouched: () => void;
@@ -327,6 +331,12 @@ export interface Validator {
327331
};
328332
}
329333

334+
export interface ValidatorFn {
335+
(c: AbstractControl): {
336+
[key: string]: any;
337+
};
338+
}
339+
330340
export declare class Validators {
331341
static compose(validators: ValidatorFn[]): ValidatorFn;
332342
static composeAsync(validators: AsyncValidatorFn[]): AsyncValidatorFn;

0 commit comments

Comments
 (0)