Fix bug: VariableDeclaration may have SemanticMeaning.All if an @enum in JS (#27085)

This commit is contained in:
Andy 2018-09-14 09:20:54 -07:00 committed by GitHub
parent 009dc0f1b9
commit 95c1570c4b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 1 deletions

View file

@ -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:

View 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;
}`);