Open Boke-Space opened 1 month ago
This limitation has been resolved in 3.3. The latest version of Vue supports referencing imported and a limited set of complex types in the type parameter position. However, because the type to runtime conversion is still AST-based, some complex types that require actual type analysis, e.g. conditional types, are not supported. You can use conditional types for the type of a single prop, but not the entire props object.
https://vuejs.org/api/sfc-script-setup.html#type-only-props-emit-declarations
Try https://github.com/so1ve/vue.ts/tree/main/packages/complex-types
Hi! I have similar issue with class-variance-authority library which is very painful((
Vue version
3.4.27
Link to minimal reproduction
https://stackblitz.com/edit/vitejs-vite-wennky?file=src%2FApp.vue,tsconfig.json,src%2Fmain.ts,src%2Fcomponents%2FHelloWorld.vue,src%2Fcomponents%2Ftype.ts,src%2Fcomponents%2FTable.vue&terminal=dev
Steps to reproduce
组件
Helloworld
引入类型TableEmits发生错误组件
Test
引入类型TableEmits成功运行What is expected?
组件
HelloWorld
传入ElTable
得到事件的联合类型What is actually happening?
[plugin:vite:vue] [@vue/compiler-sfc] Unresolvable type: TSConditionalType
/home/projects/vitejs-vite-wennky/node_modules/.pnpm/vue-component-type-helpers@2.0.26/node_modules/vue-component-type-helpers/index.d.ts 10 | emit: any; 11 | }, ...args: any) => any ? NonNullable
: {}; 12 | export type ComponentEmit = T extends new (...angs: any) => {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13 | $emit: infer E;
| ^^^^^^^^^^^^^^^^^^^
14 | } ? NonNullable : {};
| ^^^^^^^^^^^^^^^^^^^^^^^ System Info
No response
Any additional comments?
No response