@@ -17,13 +17,11 @@ export function transformJsxMacros(
17
17
const asyncModifier = root . modifiers ?. find (
18
18
( modifier ) => modifier . kind === ts . SyntaxKind . AsyncKeyword ,
19
19
)
20
+ let setup = `typeof ${ HELPER_PREFIX } setup`
21
+ setup = asyncModifier ? `Awaited<${ setup } >` : setup
20
22
if ( asyncModifier && map . defineComponent )
21
23
replaceRange ( codes , asyncModifier . pos , asyncModifier . end )
22
- const result = `({}) as __VLS_PickNotAny<Awaited<ReturnType<typeof ${
23
- HELPER_PREFIX
24
- } setup>>['render'], {}> & { __ctx: Awaited<ReturnType<typeof ${
25
- HELPER_PREFIX
26
- } setup>> }`
24
+ const result = `({}) as __VLS_PickNotAny<${ setup } ['render'], {}> & { __ctx: ${ setup } }`
27
25
28
26
const propsType = root . parameters [ 0 ] ?. type
29
27
? String ( root . parameters [ 0 ] . type . getText ( ast ) )
@@ -33,7 +31,7 @@ export function transformJsxMacros(
33
31
root . parameters . pos ,
34
32
root . parameters . pos ,
35
33
ts . isArrowFunction ( root ) && root . parameters . pos === root . pos ? '(' : '' ,
36
- `${ HELPER_PREFIX } props: Awaited<ReturnType<typeof ${ HELPER_PREFIX } setup>> ['props'] & ${ propsType } , ` ,
34
+ `${ HELPER_PREFIX } props: ${ setup } ['props'] & ${ propsType } , ` ,
37
35
`${ HELPER_PREFIX } placeholder?: {}, ` ,
38
36
`${ HELPER_PREFIX } setup = (${ asyncModifier ? 'async' : '' } (` ,
39
37
)
@@ -42,7 +40,7 @@ export function transformJsxMacros(
42
40
codes ,
43
41
root . end ,
44
42
root . end ,
45
- `))${ root . pos === root . parameters . pos ? ')' : '' } => ` ,
43
+ `)() )${ root . pos === root . parameters . pos ? ')' : '' } => ` ,
46
44
result ,
47
45
)
48
46
} else {
@@ -52,7 +50,7 @@ export function transformJsxMacros(
52
50
root . body . getStart ( ast ) ,
53
51
'=>' ,
54
52
)
55
- replaceRange ( codes , root . end , root . end , `)){ return ` , result , '}' )
53
+ replaceRange ( codes , root . end , root . end , `)() ){ return ` , result , '}' )
56
54
}
57
55
58
56
ts . forEachChild ( root . body , ( node ) => {
0 commit comments