-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[vue3] Props type inference breaks, if custom-validator is present #2738
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
Comments
This is a known issue and is a limitation of TypeScript handling circular inference of There is currently no fix for this (will have to be upstream in TS) so using arrow function is the recommended workaround. |
@kuanyui You will still need to type the validators parameter: size: {
type: String,
default: 'md',
validator: (x: string) => { ... }
} |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Version
3.0.4
Reproduction link
https://github.com./MarcRoemmelt/vue-lost-proptypes
Steps to reproduce
setup(props)
orthis.$props
What is expected?
Type inference for all props should work regardless of custom-validator
What is actually happening?
If a validator function is present in any prop, the type inference breaks. Interestingly, if the validator is an arrow-function it it works.
The text was updated successfully, but these errors were encountered: