Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple Validators throwing TypeError #22

Closed
Coly010 opened this issue May 27, 2020 · 3 comments
Closed

Multiple Validators throwing TypeError #22

Coly010 opened this issue May 27, 2020 · 3 comments

Comments

@Coly010
Copy link
Collaborator

Coly010 commented May 27, 2020

From short initial investigation it seems like this typing:

validators?: ValidatorFn<T, Partial<E>> | ValidatorFn<T, Partial<E>>[] | null;

Needs to be changed to be recursive in such a way that it can aggregate the different Validators that are used on a FormControl

At the moment, an error is thrown for the following:

email: new FormControl('', [Validators.required, Validators.email])

Which states that {email: true} is not assignable to {required: true}.

I believe this needs a slight change to how the object type is built.

@Coly010
Copy link
Collaborator Author

Coly010 commented May 27, 2020

I feel like we might need something similar to this, except with Partial instead of Readonly

https://twitter.com/mgechev/status/1240178886979223552?s=20

@Coly010
Copy link
Collaborator Author

Coly010 commented May 27, 2020

After further investigation I've narrowed this down further.

It occurs when we do not pass a Type definition for the formState.

image

@Coly010
Copy link
Collaborator Author

Coly010 commented May 27, 2020

@NetanelBasal I'm coming up blank on how to fix it. My best suggestion right now is to potentially advice users of this scenario.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants