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

Incorrect Problem Reported with VeeValidate #41

Closed
JohnCampionJr opened this issue Jan 10, 2021 · 6 comments
Closed

Incorrect Problem Reported with VeeValidate #41

JohnCampionJr opened this issue Jan 10, 2021 · 6 comments
Labels
bug Something isn't working

Comments

@JohnCampionJr
Copy link

Hi, made a test repo, thinking this was an issue with VeeValidate. But the error only appears in VS Code with Volar. Vetur does not indicate this problem, which leads me to think its a Volar issue.

https://github.com/JohnCampionJr/vee-validate-vue3-ts

Volar throws an error in the validation page, with the VeeValidate Form submit handler having more than one property.

@johnsoncodehk
Copy link
Member

Hi @JohnCampionJr, the onSubmit function is not matching for @submit emit type, Vetur no errors because it do not support events type checking.

The original @submit type of (payload: Event) => void is come from vue library, if @submit of vee-validate From should be other type, vee-validate should define they own onSubmit prop to override the original type. You should open a issue to vee-validate for that.

@johnsoncodehk johnsoncodehk added the question Further information is requested label Jan 10, 2021
@JohnCampionJr
Copy link
Author

OK, I've contacted them, thanks.

@logaretm
Copy link

logaretm commented Jan 10, 2021

Hello @johnsoncodehk, vee-validate author here. great work with volar.

I tried adding a onSubmit prop like you suggested on the Form component and it didn't work, it tries to match it to both (payload: Event) => void and the custom vee-validate type.

Type '(values: any, actions: any) => void' is not assignable to type 'SubmissionHandler<Record<string, any>> & ((payload: Event) => void)'.ts(2322)

I think it shouldn't try to intersect the custom prop with & ((payload: Event) => void)

Any pointers?

@johnsoncodehk
Copy link
Member

Hi @logaretm, sorry I just found this is a types bug from Volar when props duplicate name with HTMLAttributes. I will publish a new version to fix now.

@JohnCampionJr
Copy link
Author

You are both amazing coders - thanks for fixing this!

@johnsoncodehk
Copy link
Member

please try 0.19.6.

and I found a other problem you may need to note. your component name Form is duplicate name with native elements, so props autocomplete is broke, if you need autocomplete, you need to rename Form for now, I will fix it.

螢幕截圖 2021-01-11 上午8 01 56

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants