Skip to content

Commit 95c1570

Browse files
author
Andy
authored
Fix bug: VariableDeclaration may have SemanticMeaning.All if an @enum in JS (microsoft#27085)
1 parent 009dc0f commit 95c1570

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/services/utilities.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ namespace ts {
2323

2424
export function getMeaningFromDeclaration(node: Node): SemanticMeaning {
2525
switch (node.kind) {
26-
case SyntaxKind.Parameter:
2726
case SyntaxKind.VariableDeclaration:
27+
return isInJSFile(node) && getJSDocEnumTag(node) ? SemanticMeaning.All : SemanticMeaning.Value;
28+
29+
case SyntaxKind.Parameter:
2830
case SyntaxKind.BindingElement:
2931
case SyntaxKind.PropertyDeclaration:
3032
case SyntaxKind.PropertySignature:
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
// @allowJs: true
4+
5+
// @Filename: /a.js
6+
/////** @enum {string} */
7+
////const [|{| "isWriteAccess": true, "isDefinition": true |}E|] = { A: "" };
8+
////[|E|]["A"];
9+
/////** @type {[|E|]} */
10+
////const e = [|E|].A;
11+
12+
verify.singleReferenceGroup(
13+
`enum E
14+
const E: {
15+
A: string;
16+
}`);

0 commit comments

Comments
 (0)