@@ -17,13 +17,11 @@ export function transformJsxMacros(
1717 const asyncModifier = root . modifiers ?. find (
1818 ( modifier ) => modifier . kind === ts . SyntaxKind . AsyncKeyword ,
1919 )
20+ let setup = `typeof ${ HELPER_PREFIX } setup`
21+ setup = asyncModifier ? `Awaited<${ setup } >` : setup
2022 if ( asyncModifier && map . defineComponent )
2123 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 } }`
2725
2826 const propsType = root . parameters [ 0 ] ?. type
2927 ? String ( root . parameters [ 0 ] . type . getText ( ast ) )
@@ -33,7 +31,7 @@ export function transformJsxMacros(
3331 root . parameters . pos ,
3432 root . parameters . pos ,
3533 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 } , ` ,
3735 `${ HELPER_PREFIX } placeholder?: {}, ` ,
3836 `${ HELPER_PREFIX } setup = (${ asyncModifier ? 'async' : '' } (` ,
3937 )
@@ -42,7 +40,7 @@ export function transformJsxMacros(
4240 codes ,
4341 root . end ,
4442 root . end ,
45- `))${ root . pos === root . parameters . pos ? ')' : '' } => ` ,
43+ `)() )${ root . pos === root . parameters . pos ? ')' : '' } => ` ,
4644 result ,
4745 )
4846 } else {
@@ -52,7 +50,7 @@ export function transformJsxMacros(
5250 root . body . getStart ( ast ) ,
5351 '=>' ,
5452 )
55- replaceRange ( codes , root . end , root . end , `)){ return ` , result , '}' )
53+ replaceRange ( codes , root . end , root . end , `)() ){ return ` , result , '}' )
5654 }
5755
5856 ts . forEachChild ( root . body , ( node ) => {
0 commit comments