定义接口IEvents问题

来源:3-19 Vue3.3更新简介

慕运维4335526

2024-11-07

图片描述
Type ‘IEvents’ does not satisfy the constraint ‘ComponentTypeEmits’.
Type ‘IEvents’ is not assignable to type ‘Record<string, any[]>’.ts(2344)
Type ‘IEvents’ does not satisfy the constraint ‘ComponentTypeEmits’.
Type ‘IEvents’ is not assignable to type ‘Record<string, any[]>’.
Index signature for type ‘string’ is missing in type ‘IEvents’.
为什么定义的IEvents接口用下面change: [hidden: boolean]就会报上面的错,然后用[change: string]: [hidden: boolean]就正常。
vue版本已经是3.5.12

写回答

1回答

张轩

2024-11-08

同学你好

请提供一下你的源代码,我在本地帮你看一下

0
0

进阶必学,打造媲美ElementPlus的组件库

Vue3.3 + TS4 ,自主打造媲美 ElementPlus 的组件库

482 学习 · 219 问题

查看课程