-
-
Notifications
You must be signed in to change notification settings - Fork 413
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
Impossible to override native events #116
Comments
Try this: import { defineComponent, PropType } from 'vue'
export default defineComponent({
props: {
onClick: Function as PropType<(a: string) => void>,
...
},
}) See: #41 (comment) |
Hmm yes that works, but still, shouldn't we be able to just define the emits and make it work out of the box? I feel like what you're suggesting is a workaround. Am I wrong for thinking this is a bug? If so, why? |
Vue document does not clearly point out events priority from props and emits, so now only allow override native events with same props to avoid confusion. It may change in the future. |
The documentation literally states:
So given that, I think it's clear that Volar should use the component event instead of the native event in these cases. |
Thanks to point this out! |
Fixed in 0.22.24. |
That was quick, thank you! |
v0.32.1 It looks like a similar problem |
v0.32.1 still get this: |
Hello!
It seems like it's impossible to override native events. Simple example:
and another component using
Foo.vue
:Volar incorrectly gives the error
Type '(k: string) => void is not assignable to type '(payload: Event) => void'.
for all event bindings, exceptfoobar
, the non-native one.I don't think this is desirable behaviour. Vue works exactly how I expect it to work, but Volar does not.
The text was updated successfully, but these errors were encountered: