@volar/vue-language-core
Advanced tools
Comparing version 1.3.12 to 1.3.13
@@ -56,2 +56,3 @@ "use strict"; | ||
ToTemplateSlots: false, | ||
PropsChildren: false, | ||
}; | ||
@@ -134,5 +135,6 @@ if (vueCompilerOptions.jsxTemplates && vueCompilerOptions.target >= 3.3) { | ||
if (usedHelperTypes.WithTemplateSlots) { | ||
usedHelperTypes.PropsChildren = true; | ||
codes.push(`type __VLS_WithTemplateSlots<T, S> = T & { new(): { | ||
$slots: S; | ||
$props: { [K in keyof JSX.ElementChildrenAttribute]: S; }; | ||
$props: __VLS_PropsChildren<S>; | ||
} };\n`); | ||
@@ -143,2 +145,5 @@ } | ||
} | ||
if (usedHelperTypes.PropsChildren) { | ||
codes.push(`type __VLS_PropsChildren<S> = { [K in keyof (boolean extends (JSX.ElementChildrenAttribute extends never ? true : false) ? never : JSX.ElementChildrenAttribute)]?: S; };\n`); | ||
} | ||
if (usedPrettify) { | ||
@@ -349,5 +354,6 @@ codes.push(`type __VLS_Prettify<T> = { [K in keyof T]: T[K]; } & {};\n`); | ||
usedHelperTypes.ToTemplateSlots = true; | ||
codes.push(` & { [K in keyof JSX.ElementChildrenAttribute]: __VLS_ToTemplateSlots<`); | ||
usedHelperTypes.PropsChildren = true; | ||
codes.push(` & __VLS_PropsChildren<__VLS_ToTemplateSlots<`); | ||
addExtraReferenceVirtualCode('scriptSetup', scriptSetupRanges.slotsTypeArg.start, scriptSetupRanges.slotsTypeArg.end); | ||
codes.push(`>; }`); | ||
codes.push(`>>`); | ||
} | ||
@@ -360,5 +366,6 @@ codes.push(`;\n`); | ||
usedHelperTypes.ToTemplateSlots = true; | ||
codes.push(` & { [K in keyof JSX.ElementChildrenAttribute]: __VLS_ToTemplateSlots<`); | ||
usedHelperTypes.PropsChildren = true; | ||
codes.push(` & __VLS_PropsChildren<__VLS_ToTemplateSlots<`); | ||
addExtraReferenceVirtualCode('scriptSetup', scriptSetupRanges.slotsTypeArg.start, scriptSetupRanges.slotsTypeArg.end); | ||
codes.push(`>; }`); | ||
codes.push(`>>`); | ||
} | ||
@@ -478,8 +485,16 @@ if (scriptSetupRanges.propsTypeArg) { | ||
let propName = 'modelValue'; | ||
if (defineProp.name) { | ||
if (defineProp.name && defineProp.nameIsString) { | ||
// renaming support | ||
addExtraReferenceVirtualCode('scriptSetup', defineProp.name.start, defineProp.name.end); | ||
} | ||
else if (defineProp.name) { | ||
propName = sfc.scriptSetup.content.substring(defineProp.name.start, defineProp.name.end); | ||
const start = muggle.getLength(codes); | ||
definePropMirrors[propName] = [start, start + propName.length]; | ||
codes.push(propName); | ||
} | ||
codes.push(`${propName}: `); | ||
else { | ||
codes.push(propName); | ||
} | ||
codes.push(`: `); | ||
let type = 'any'; | ||
@@ -612,8 +627,3 @@ if (!defineProp.nameIsString) { | ||
codes.push(`var __VLS_slots!: __VLS_ToTemplateSlots<`); | ||
codes.push([ | ||
sfc.scriptSetup.content.substring(scriptSetupRanges.slotsTypeArg.start, scriptSetupRanges.slotsTypeArg.end), | ||
sfc.scriptSetup.name, | ||
[scriptSetupRanges.slotsTypeArg.start, scriptSetupRanges.slotsTypeArg.end], | ||
language_core_1.FileRangeCapabilities.full, | ||
]); | ||
addExtraReferenceVirtualCode('scriptSetup', scriptSetupRanges.slotsTypeArg.start, scriptSetupRanges.slotsTypeArg.end); | ||
codes.push('>;\n'); | ||
@@ -620,0 +630,0 @@ } |
@@ -83,6 +83,6 @@ "use strict"; | ||
: 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<T, K>(t: T, instance?: K): | ||
export declare function asFunctionalComponent<T, K = T extends new (...args: any) => any ? InstanceType<T> : unknown>(t: T, instance?: K): | ||
T extends (...args: any) => any ? T | ||
: K extends { $props?: infer Props, $slots?: infer Slots, $emit?: infer Emit } | ||
? (props: Props, ctx?: { attrs?: any, expose?: any, slots?: Slots, emit?: Emit }) => JSX.Element & { __ctx?: typeof ctx, __props?: typeof props } | ||
? (props: Props, ctx?: { attrs?: any, expose?(exposed: K): void, slots?: Slots, emit?: Emit }) => JSX.Element & { __ctx?: typeof ctx, __props?: typeof props } | ||
: (_: T, ctx?: any) => { __ctx?: { attrs?: undefined, expose?: undefined, slots?: undefined, emit?: undefined }, __props?: T }; // IntrinsicElement | ||
@@ -89,0 +89,0 @@ export declare function pickEvent<Emit, K, E>(emit: Emit, emitKey: K, event: E): FillingEventArg< |
{ | ||
"name": "@volar/vue-language-core", | ||
"version": "1.3.12", | ||
"version": "1.3.13", | ||
"main": "out/index.js", | ||
@@ -29,3 +29,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "03f8745d7428faee5c89d17e65d4cb76961efb2b" | ||
"gitHead": "f1f2e7de96e46599a2c84c801f43ecf91d08d4b7" | ||
} |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
235254
5230