fix(forms): accept number length in length validators#32057
fix(forms): accept number length in length validators#32057cexbrayat wants to merge 1 commit intoangular:masterfrom
Conversation
|
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
8a143fa to
177ba2c
Compare
|
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
177ba2c to
649ffdc
Compare
649ffdc to
0b85cd2
Compare
0b85cd2 to
12f70c7
Compare
12f70c7 to
f96e98d
Compare
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.
f96e98d to
8dd6d47
Compare
AndrewKushnir
left a comment
There was a problem hiding this comment.
The change LGTM, but I think we need to check whether it should go to v9 or v10. Thank you.
|
FYI, I've put "blocked" label for now to make sure that we merge it once the decision is made on when this PR should be merged (v9 or v10). |
IgorMinar
left a comment
There was a problem hiding this comment.
lgtm for api change. this is minor enough that it can go to v9.0.
thanks @cexbrayat!
|
For the record, we don't consider this to be a breaking change for public api, because we discourage people from extend our classes unless we documented that the class is meant to be subclassed:
|
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 issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |

PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Both
MinLengthValidatorandMaxLengthValidatoraccepted only string inputs for the length required, which throws with Ivy andfullTemplateTypeCheckenabled:with:
What is the new behavior?
This relaxes the accepted type to
string | numberto avoid breakage when developers switch to Ivy and fTTC.Does this PR introduce a breaking change?
If someone extends one of these validators in their own code, then yes, they'll have to pdate the type of the
minlength/maxlengthfield.Other information