Missing typing for emmited event for generic components which define different casing style #3197
Labels
bug
Something isn't working
good reproduction ✨
This issue provides a good reproduction, we will be able to investigate it first
Vue version
3.3.2
Link to minimal reproduction
https://stackblitz.com/edit/vitejs-vite-hjlpod?file=src/App.vue&view=editor
Steps to reproduce
npm run typecheck
into the terminalApp.vue
file aboutany
type for the argument of the@update:model-value
emitWhat is expected?
Types for emits are inferred correctly in the template for generic components. So for defined
inside the component, both event listeners (
@update:model-value
and@update:modelValue
) should be valid like it works for components without generic.This will be better for consistency between generic and non-generic components and kebab-case follows the recommendation of writing emits in a template.
What is actually happening?
The generic component only knows the emit type with the same casing style that is defined inside of this generic component. So as for the repro link typescript can't see the kebab-case subscription on the event with the defined camelCase emit inside the component.
System Info
Any additional comments?
Recommendations in the vue documentation say that using camelCase for defining props/emits and kebab-case for props/listeners is recommended way, also
eslint-plugin-vue
has the same recommendations, so it's a regular error if using these recommendations.The text was updated successfully, but these errors were encountered: