Skip to content

Commit 3271ddc

Browse files
committed
feat: support ExpressionWithTypeArguments
1 parent 4f01ff9 commit 3271ddc

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/index.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@ import type * as t from '@babel/types'
1515

1616
function transformArguments(argument: t.Node, s: MagicString, offset: number) {
1717
if (
18-
argument.type === 'Identifier' ||
19-
argument.type === 'MemberExpression' ||
20-
argument.type === 'OptionalMemberExpression'
18+
[
19+
'Identifier',
20+
'MemberExpression',
21+
'OptionalMemberExpression',
22+
'TSInstantiationExpression',
23+
].includes(argument.type)
2124
) {
2225
s.appendLeft(argument.start! + offset, '$$(')
2326
s.appendRight(argument.end! + offset, ')')

src/volar.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ function transform({
2020
function transformArguments(
2121
argument: import('typescript/lib/tsserverlibrary').Node
2222
) {
23-
if (ts.isIdentifier(argument) || ts.isPropertyAccessExpression(argument)) {
23+
if (
24+
ts.isIdentifier(argument) ||
25+
ts.isPropertyAccessExpression(argument) ||
26+
ts.isExpressionWithTypeArguments(argument)
27+
) {
2428
replaceSourceRange(
2529
codes,
2630
source,

0 commit comments

Comments
 (0)