Skip to content

Commit 9f9cda6

Browse files
committed
fix: Pick up the correct slot scope type from $slots
See: vuejs#539 (comment)
1 parent 0adcbbd commit 9f9cda6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ declare global {
6666
: T extends FunctionDirective<infer E, infer V> ? V extends { value: infer V_2 } ? (value: V_2) => void : (value: V) => void : T;
6767
6868
function __VLS_getTemplateSlots<T>(t: T): T extends { __VLS_slots: infer S } ? S : {};
69-
function __VLS_getScriptSlots<T>(t: T): T extends new (...args: any) => { $slots?: infer S } ? (S extends object ? S : {}) : {};
69+
type __VLS_SlotScopeType<T> = T extends vue_3.Slot ? Parameters<T>[0] : undefined;
70+
function __VLS_getScriptSlots<T>(t: T): T extends new (...args: any) => { $slots?: infer S }
71+
? S extends vue_3.Slots ? Record<keyof S, __VLS_SlotScopeType<S[keyof S]>> : {}
72+
: {};
7073
7174
type __VLS_GetComponentName<T, K extends string> = K extends keyof T ? IsAny<T[K]> extends false ? K : __VLS_GetComponentName_CamelCase<T, CamelCase<K>> : __VLS_GetComponentName_CamelCase<T, CamelCase<K>>;
7275
type __VLS_GetComponentName_CamelCase<T, K extends string> = K extends keyof T ? IsAny<T[K]> extends false ? K : __VLS_GetComponentName_CapitalCase<T, Capitalize<K>> : __VLS_GetComponentName_CapitalCase<T, Capitalize<K>>;

0 commit comments

Comments
 (0)