Open
Description
Vue version
3.5
Link to minimal reproduction
Steps to reproduce
create a custom component with a generic T, defineModel and defineEmits like the code below
<script setup lang="ts" generic="T extends Item, U extends T">
export type Item = {
text: string;
value: string
}
const props = defineProps<{ items: T[] }>()
const model = defineModel<U[]>()
defineEmits<{
'update:modelValue': [items: U[]]
}>()
</script>
<template>
<div>
<slot />
</div>
</template>
and from you parent component use this
<script setup>
import { ref } from 'vue'
import Comp from './Comp.vue';
const myModel = ref([{
text: 'text', value: 'value'
}])
</script>
<template>
<Comp v-model="myModel" :items="[{ text: 'some item', value: 'some item' }]" @update:modelValue=""></Comp>
</template>
and if I hover the @update:modelValue
I get unknown args instead of T
What is expected?
I should see the type of T when hover on @update:modelValue
What is actually happening?
I found out this this happens only on vue 3.5, when using 3.4 it works well
3.5
3.4
I also noticed that this happens only for @update:modelValue
, for example if I have @update:modelAnythingElse
in vue 3.5 it works just fine
and I also noticed that only if I call the defineEmits()
in the child component this happens
if I don't call the defineEmits()
the types are correct on the default @update:modelValue
System Info
System:
OS: macOS 14.6.1
CPU: (14) arm64 Apple M3 Max
Memory: 167.28 MB / 36.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.16.0 - ~/.nvm/versions/node/v20.16.0/bin/node
npm: 10.8.1 - ~/.nvm/versions/node/v20.16.0/bin/npm
pnpm: 9.0.6 - /opt/homebrew/bin/pnpm
Watchman: 2024.10.14.00 - /opt/homebrew/bin/watchman
Browsers:
Brave Browser: 127.1.68.128
Chrome: 130.0.6723.58
Safari: 17.6
Any additional comments?
No response