Skip to content

Commit b809986

Browse files
committed
refactor(macros): improve tsslint compatibility
1 parent 5d07ab3 commit b809986

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

packages/macros/src/volar/transform.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,21 @@ export function transformJsxMacros(
8383
codes,
8484
node.getStart(ast),
8585
node.expression.getStart(ast),
86-
`return {\nprops: {} as { ${props.join(', ')} }`,
87-
`,\nslots: {} as ${map.defineSlots ?? '{}'}`,
88-
`,\nexpose: (exposed: import('vue').ShallowUnwrapRef<${map.defineExpose ?? '{}'}>) => {}`,
89-
`,\nrender: `,
86+
`const ${HELPER_PREFIX}render = `,
9087
shouldWrapByCall ? '(' : '',
9188
)
9289
replaceRange(
9390
codes,
9491
node.expression.end,
9592
node.expression.end,
9693
shouldWrapByCall ? ')()' : '',
97-
`\n}`,
94+
`
95+
return {
96+
props: {} as {${props.join(', ')}},
97+
slots: {} as ${map.defineSlots ?? '{}'},
98+
expose: (exposed: import('vue').ShallowUnwrapRef<${map.defineExpose ?? '{}'}>) => {},
99+
render: ${HELPER_PREFIX}render,
100+
}`,
98101
)
99102
}
100103
})

0 commit comments

Comments
 (0)