Fix bug: VariableDeclaration may have SemanticMeaning.All if an @enum
in JS (#27085)
This commit is contained in:
parent
009dc0f1b9
commit
95c1570c4b
|
@ -23,8 +23,10 @@ namespace ts {
|
|||
|
||||
export function getMeaningFromDeclaration(node: Node): SemanticMeaning {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.Parameter:
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
return isInJSFile(node) && getJSDocEnumTag(node) ? SemanticMeaning.All : SemanticMeaning.Value;
|
||||
|
||||
case SyntaxKind.Parameter:
|
||||
case SyntaxKind.BindingElement:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
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