The type of value passed in the 'emit' is different from the type of the 'ev.detail' that fired the custom event
Vue version
3.3.4
Link to minimal reproduction
https://stackblitz.com/edit/vitejs-vite-ftw1xc?file=src%2FApp.vue
Steps to reproduce
Click the button in the example to see this(点击例子中按钮可以直接看到).
What is expected?
In your custom component, the type of 'ev.detail' should be the same as the type of the second argument to 'emit'(在自定义组件中,ev.detail
的类型应该和 emit
第二参数的类型一样)
What is actually happening?
The type of value passed in the 'emit' is different from the type of the 'ev.detail' that fired the custom event(emit
中传的值的类型与触发自定义事件中 ev.detail
的类型不同。)
System Info
No response
Any additional comments?
this is by design. see docs
https://vuejs.org/api/component-instance.html#emit
interface ComponentPublicInstance {
$emit(event: string, ...args: any[]): void
}
$emit
accepts multiple arguments.