Skip to content

Commit d587ab1

Browse files
committed
fix: slots type incorrect if component type is any
1 parent 2c6511b commit d587ab1

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/vscode-vue-languageservice/src/utils/globalDoc.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,11 @@ declare global {
8080
: T extends FunctionDirective<infer E, infer V> ? V extends { value: infer V_2 } ? (value: V_2) => void : (value: V) => void : T;
8181
8282
type __VLS_TemplateSlots<T> = T extends { __VLS_slots: infer S } ? S : {};
83-
type __VLS_DefaultSlots<W, R> = W extends { __VLS_slots: infer _ }
84-
? {} : R extends new (...args: any) => { $slots?: infer _ }
85-
? {} : Record<string, any>;
83+
type __VLS_HasTemplateSlotsType<T> = T extends { __VLS_slots: infer _ } ? true : false;
84+
type __VLS_HasScriptSlotsType<T> = T extends new (...args: any) => { $slots?: infer _ } ? true : false;
85+
type __VLS_DefaultSlots<W, R> = __VLS_HasTemplateSlotsType<W> extends true ? {}
86+
: __VLS_HasScriptSlotsType<R> extends true ? {}
87+
: Record<string, any>;
8688
type __VLS_SlotsComponent<T> = T extends new (...args: any) => { $slots?: infer S } ? T : new (...args: any) => { $slots: {} };
8789
type __VLS_ScriptSlots<T> = T extends { $slots?: infer S }
8890
? { [K in keyof S]-?: S[K] extends ((obj: infer O) => any) | undefined ? O : S[K] }

0 commit comments

Comments
 (0)