Skip to content

Commit 9bcfac2

Browse files
authored
feat(volar/jsx-directive): support infer type from setup (#982)
1 parent 294b207 commit 9bcfac2

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

packages/volar/src/jsx-directive/context.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,11 @@ declare function __VLS_getFunctionalComponentCtx<T, K, const S>(
4141
s: S,
4242
): S extends keyof typeof __VLS_nativeElements
4343
? { expose: (exposed: (typeof __VLS_nativeElements)[S]) => any }
44-
: '__ctx' extends keyof __VLS_PickNotAny<K, {}>
45-
? K extends { __ctx?: infer Ctx }
46-
? Ctx
47-
: never
48-
: T extends (props: infer P, ctx: infer Ctx) => any
49-
? { props: P } & Ctx
50-
: {};\n`)
44+
: T extends { setup: (props: infer P, ctx: infer Ctx) => any } ? { props: P } & Ctx :
45+
'__ctx' extends keyof __VLS_PickNotAny<K, {}>
46+
? K extends { __ctx?: infer Ctx } ? Ctx : never
47+
: T extends (props: infer P, ctx: infer Ctx) => any ? { props: P } & Ctx
48+
: {};\n`)
5149
}
5250

5351
return new Map(

0 commit comments

Comments
 (0)