fix(forms): accept number length in length validators (#32057)
Both `MinLengthValidator` and `MaxLengthValidator` accepted only string inputs for the length required, which throws with Ivy and `fullTemplateTypeCheck` enabled: <!-- min = 2 in the component --> <input [minlength]="min"> with: Type 'number' is not assignable to type 'string | undefined' This relaxes the accepted type to `string | number` to avoid breakage when developers switch to Ivy and fTTC. PR Close #32057
This commit is contained in:
4
tools/public_api_guard/forms/forms.d.ts
vendored
4
tools/public_api_guard/forms/forms.d.ts
vendored
@ -330,14 +330,14 @@ export declare class FormsModule {
|
||||
}
|
||||
|
||||
export declare class MaxLengthValidator implements Validator, OnChanges {
|
||||
maxlength: string;
|
||||
maxlength: string | number;
|
||||
ngOnChanges(changes: SimpleChanges): void;
|
||||
registerOnValidatorChange(fn: () => void): void;
|
||||
validate(control: AbstractControl): ValidationErrors | null;
|
||||
}
|
||||
|
||||
export declare class MinLengthValidator implements Validator, OnChanges {
|
||||
minlength: string;
|
||||
minlength: string | number;
|
||||
ngOnChanges(changes: SimpleChanges): void;
|
||||
registerOnValidatorChange(fn: () => void): void;
|
||||
validate(control: AbstractControl): ValidationErrors | null;
|
||||
|
Reference in New Issue
Block a user