Fix bug: VariableDeclaration may have SemanticMeaning.All if an @enum
in JS (#27085)
This commit is contained in:
parent
009dc0f1b9
commit
95c1570c4b
2 changed files with 19 additions and 1 deletions
|
@ -23,8 +23,10 @@ namespace ts {
|
||||||
|
|
||||||
export function getMeaningFromDeclaration(node: Node): SemanticMeaning {
|
export function getMeaningFromDeclaration(node: Node): SemanticMeaning {
|
||||||
switch (node.kind) {
|
switch (node.kind) {
|
||||||
case SyntaxKind.Parameter:
|
|
||||||
case SyntaxKind.VariableDeclaration:
|
case SyntaxKind.VariableDeclaration:
|
||||||
|
return isInJSFile(node) && getJSDocEnumTag(node) ? SemanticMeaning.All : SemanticMeaning.Value;
|
||||||
|
|
||||||
|
case SyntaxKind.Parameter:
|
||||||
case SyntaxKind.BindingElement:
|
case SyntaxKind.BindingElement:
|
||||||
case SyntaxKind.PropertyDeclaration:
|
case SyntaxKind.PropertyDeclaration:
|
||||||
case SyntaxKind.PropertySignature:
|
case SyntaxKind.PropertySignature:
|
||||||
|
|
16
tests/cases/fourslash/findAllRefs_jsEnum.ts
Normal file
16
tests/cases/fourslash/findAllRefs_jsEnum.ts
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
/// <reference path='fourslash.ts' />
|
||||||
|
|
||||||
|
// @allowJs: true
|
||||||
|
|
||||||
|
// @Filename: /a.js
|
||||||
|
/////** @enum {string} */
|
||||||
|
////const [|{| "isWriteAccess": true, "isDefinition": true |}E|] = { A: "" };
|
||||||
|
////[|E|]["A"];
|
||||||
|
/////** @type {[|E|]} */
|
||||||
|
////const e = [|E|].A;
|
||||||
|
|
||||||
|
verify.singleReferenceGroup(
|
||||||
|
`enum E
|
||||||
|
const E: {
|
||||||
|
A: string;
|
||||||
|
}`);
|
Loading…
Reference in a new issue