[Bug]: NativeSelect update:modelValue emit typing causes TS2322 for callbacks with a value parameter#2015
Reproduction
On dev at d1bf1b3a2d1a824b19f32d7253a28a43797b8253, add native-select to a Vue + TypeScript project and use:
<script setup lang="ts">
import type { AcceptableValue } from "reka-ui"
import { NativeSelect, NativeSelectOption } from "@/components/ui/native-select"
function onValueChange(value: AcceptableValue) {
console.log(value)
}
</script>
<template>
<NativeSelect @update:model-value="onValueChange">
<NativeSelectOption value="one">One</NativeSelectOption>
<NativeSelectOption value="two">Two</NativeSelectOption>
</NativeSelect>
</template>
Run the project's Vue typecheck (vue-tsc --noEmit) or inspect the template with Vue language tools. Binding a callback that takes the emitted value produces TS2322. The callback should accept the emitted AcceptableValue without an error.
Describe the bug
Both source registries declare the payload type directly as the event's value:
const emit = defineEmits<{
"update:modelValue": AcceptableValue
}>()
Vue's object-form type declaration expects an argument tuple, so this should be:
const emit = defineEmits<{
"update:modelValue": [value: AcceptableValue]
}>()
Affected sources:
apps/v4/registry/new-york-v4/ui/native-select/NativeSelect.vue