From 9f9cda61a8e0ed05174dfb0a7d7dcbd8b94a81af Mon Sep 17 00:00:00 2001 From: Yusuf Kandemir Date: Wed, 29 Sep 2021 18:11:50 +0300 Subject: [PATCH] fix: Pick up the correct slot scope type from `$slots` See: https://github.com/johnsoncodehk/volar/issues/539#issuecomment-930229898 --- packages/vscode-vue-languageservice/src/utils/globalDoc.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/vscode-vue-languageservice/src/utils/globalDoc.ts b/packages/vscode-vue-languageservice/src/utils/globalDoc.ts index e2a8edb8a8..12374f12a1 100644 --- a/packages/vscode-vue-languageservice/src/utils/globalDoc.ts +++ b/packages/vscode-vue-languageservice/src/utils/globalDoc.ts @@ -66,7 +66,10 @@ declare global { : T extends FunctionDirective ? V extends { value: infer V_2 } ? (value: V_2) => void : (value: V) => void : T; function __VLS_getTemplateSlots(t: T): T extends { __VLS_slots: infer S } ? S : {}; - function __VLS_getScriptSlots(t: T): T extends new (...args: any) => { $slots?: infer S } ? (S extends object ? S : {}) : {}; + type __VLS_SlotScopeType = T extends vue_3.Slot ? Parameters[0] : undefined; + function __VLS_getScriptSlots(t: T): T extends new (...args: any) => { $slots?: infer S } + ? S extends vue_3.Slots ? Record> : {} + : {}; type __VLS_GetComponentName = K extends keyof T ? IsAny extends false ? K : __VLS_GetComponentName_CamelCase> : __VLS_GetComponentName_CamelCase>; type __VLS_GetComponentName_CamelCase = K extends keyof T ? IsAny extends false ? K : __VLS_GetComponentName_CapitalCase> : __VLS_GetComponentName_CapitalCase>;