From 173810a593d90483fffa1a3f945e5292af95469b Mon Sep 17 00:00:00 2001 From: Johnson Chu Date: Sun, 23 Apr 2023 18:11:54 +0800 Subject: [PATCH] fix: `` slot type error close #2683 --- packages/vue-language-core/src/utils/localTypes.ts | 11 +++++++---- packages/vue-test-workspace/vue-tsc/#2683/main.vue | 5 +++++ 2 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 packages/vue-test-workspace/vue-tsc/#2683/main.vue diff --git a/packages/vue-language-core/src/utils/localTypes.ts b/packages/vue-language-core/src/utils/localTypes.ts index e59331b01..244a0c8d5 100644 --- a/packages/vue-language-core/src/utils/localTypes.ts +++ b/packages/vue-language-core/src/utils/localTypes.ts @@ -88,10 +88,13 @@ export type EmitEvent = } ? (...payload: P) => void : unknown | '[Type Warning] Volar could not infer $emit event more than 4 overloads without DefineComponent. see https://github.com/johnsoncodehk/volar/issues/60'; export declare function asFunctionalComponent any ? InstanceType : unknown>(t: T, instance?: K): - T extends new (...args: any) => any ? - K extends { $props?: infer Props, $slots?: infer Slots, $emit?: infer Emit } - ? (props: Props ${vueCompilerOptions.strictTemplates ? '' : '& Record'}, ctx?: { attrs?: any, expose?(exposed: K): void, slots?: Slots, emit?: Emit }) => JSX.Element & { __ctx?: typeof ctx, __props?: typeof props } - : never + T extends new (...args: any) => any + ? (props: (K extends { $props: infer Props } ? Props : any)${vueCompilerOptions.strictTemplates ? '' : ' & Record'}, ctx?: { + attrs?: any, + expose?(exposed: K): void, + slots?: K extends { $slots: infer Slots } ? Slots : any, + emit?: K extends { $emit: infer Emit } ? Emit : any + }) => JSX.Element & { __ctx?: typeof ctx, __props?: typeof props } : T extends () => any ? (props: {}, ctx?: any) => ReturnType : T extends (...args: any) => any ? T : (_: T & Record, ctx?: any) => { __ctx?: { attrs?: unknown, expose?: unknown, slots?: unknown, emit?: unknown }, __props?: T & Record }; // IntrinsicElement diff --git a/packages/vue-test-workspace/vue-tsc/#2683/main.vue b/packages/vue-test-workspace/vue-tsc/#2683/main.vue new file mode 100644 index 000000000..650fb1d27 --- /dev/null +++ b/packages/vue-test-workspace/vue-tsc/#2683/main.vue @@ -0,0 +1,5 @@ +