Skip to content

event listeners should consider camelCase emits #651

Closed

Description

@twisterniq

event listeners shows Not declared for a camelCase emit, this is not correct:

image

The code is:

App.vue:

<template>
  <Child @input-text="console.log('inputText')" />
</template>

<script setup>
import Child from './Child.vue';
</script>

Child.vue

<template>
  <input @input="emit('inputText')" />
</template>

<script setup>
const emit = defineEmits([
  'inputText',
])
</script>

Tested using Chrome extension Vue.js devtools, version 7.5.6.

Activity

  1. yourock1988 commented on Mar 5, 2025

    @yourock1988

    same issue

    Image

  2. razofz commented on Nov 20, 2025

    @razofz

    Ran into this as well. This means that when using the defineModel macro, where the event emitted is in camel case (update:modelValue), the devtools give a "Not declared" warning, even though the update event triggers and functions normally.

    If the component specifies defineEmits(['update:model-value']), i.e. explicit kebab-case, the event listener is considered Declared. But it seems a bit much to add that to all components in the code just to get rid of the warning in the devtools. It's one of the two parts that defineModel does, so also redundant to specify that.

    After a (quick) look in the repo code, it seems it's partly handled in process.ts, processEventListeners function. Couldn't spend more time to find out more about the instance.type.emits. The type could come from here, but no obvious emits there. It probably happens somewhere else. Could come from the any type App in the same file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions