Skip to content

Commit 3b14249

Browse files
committed
fix(volar/jsx-element): return VaporInstance for functional component
1 parent 370a431 commit 3b14249

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

packages/vue-jsx-vapor/src/volar/jsx-element.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ type __InferJsxElement<T> = T extends keyof HTMLElementTagNameMap
5757
? HTMLElementTagNameMap[T]
5858
: T extends keyof SVGElementTagNameMap
5959
? SVGElementTagNameMap[T]
60-
: T extends (...args: any[]) => any
61-
? ReturnType<T>
60+
: T extends (props: infer Props, ctx: { slots: infer Slots, expose: (exposed: infer Exposed) => void, attrs: any, emit: any }) => infer TypeBlock
61+
// @ts-ignore
62+
? import('vue-jsx-vapor').VaporComponentInstance<Props, {}, Slots, Exposed, TypeBlock>
6263
: T extends { new (...args: any[]): infer Instance }
6364
? Instance extends { $: any }
6465
? import('vue').VNode

playground/src/element.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const Comp = () => {
99
return A
1010
}
1111
const comp = <Comp />
12-
comp === ({} as HTMLAnchorElement)
12+
comp.block.href
1313

1414
const VaporComp = defineVaporComponent((props: { id: number }) => {
1515
defineSlots({

0 commit comments

Comments
 (0)