Skip to content

Commit 49aa565

Browse files
authored
fix(typescript-plugin): determine if variable is Ref by RefSymbol property (#5687)
1 parent dbe8b53 commit 49aa565

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/typescript-plugin/lib/requests/isRefAtPosition.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,14 @@ export function isRefAtPosition(
4848
const type = checker.getTypeAtLocation(node);
4949
const props = type.getProperties();
5050

51-
return props.some(prop => prop.escapedName === 'value' && prop.flags & ts.SymbolFlags.Accessor);
51+
return props.some(prop =>
52+
prop.declarations?.some(decl =>
53+
ts.isPropertySignature(decl)
54+
&& ts.isComputedPropertyName(decl.name)
55+
&& ts.isIdentifier(decl.name.expression)
56+
&& decl.name.expression.text === 'RefSymbol'
57+
)
58+
);
5259

5360
function findPositionIdentifier(sourceFile: ts.SourceFile, node: ts.Node, offset: number) {
5461
let result: ts.Node | undefined;

0 commit comments

Comments
 (0)