mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
Fix bug: Ignore @enum tag in TS (#27076)
This commit is contained in:
@@ -2666,7 +2666,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
if (!isBindingPattern(node.name)) {
|
||||
const isEnum = !!getJSDocEnumTag(node);
|
||||
const isEnum = isInJSFile(node) && !!getJSDocEnumTag(node);
|
||||
const enumFlags = (isEnum ? SymbolFlags.RegularEnum : SymbolFlags.None);
|
||||
const enumExcludes = (isEnum ? SymbolFlags.RegularEnumExcludes : SymbolFlags.None);
|
||||
if (isBlockOrCatchScoped(node)) {
|
||||
|
||||
@@ -67,4 +67,8 @@ tests/cases/compiler/jsdocInTypeScript.ts(42,12): error TS2503: Cannot find name
|
||||
* @type {{foo: (function(string, string): string)}}
|
||||
*/
|
||||
const obj = { foo: (a, b) => a + b };
|
||||
|
||||
/** @enum {string} */
|
||||
var E = {};
|
||||
E[""];
|
||||
|
||||
@@ -47,6 +47,10 @@ import M = N; // Error: @typedef does not create namespaces in TypeScript code.
|
||||
* @type {{foo: (function(string, string): string)}}
|
||||
*/
|
||||
const obj = { foo: (a, b) => a + b };
|
||||
|
||||
/** @enum {string} */
|
||||
var E = {};
|
||||
E[""];
|
||||
|
||||
|
||||
//// [jsdocInTypeScript.js]
|
||||
@@ -79,3 +83,6 @@ var M = N; // Error: @typedef does not create namespaces in TypeScript code.
|
||||
* @type {{foo: (function(string, string): string)}}
|
||||
*/
|
||||
var obj = { foo: function (a, b) { return a + b; } };
|
||||
/** @enum {string} */
|
||||
var E = {};
|
||||
E[""];
|
||||
|
||||
@@ -83,3 +83,10 @@ const obj = { foo: (a, b) => a + b };
|
||||
>a : Symbol(a, Decl(jsdocInTypeScript.ts, 47, 20))
|
||||
>b : Symbol(b, Decl(jsdocInTypeScript.ts, 47, 22))
|
||||
|
||||
/** @enum {string} */
|
||||
var E = {};
|
||||
>E : Symbol(E, Decl(jsdocInTypeScript.ts, 50, 3))
|
||||
|
||||
E[""];
|
||||
>E : Symbol(E, Decl(jsdocInTypeScript.ts, 50, 3))
|
||||
|
||||
|
||||
@@ -93,3 +93,13 @@ const obj = { foo: (a, b) => a + b };
|
||||
>a : any
|
||||
>b : any
|
||||
|
||||
/** @enum {string} */
|
||||
var E = {};
|
||||
>E : {}
|
||||
>{} : {}
|
||||
|
||||
E[""];
|
||||
>E[""] : any
|
||||
>E : {}
|
||||
>"" : ""
|
||||
|
||||
|
||||
@@ -46,3 +46,7 @@ import M = N; // Error: @typedef does not create namespaces in TypeScript code.
|
||||
* @type {{foo: (function(string, string): string)}}
|
||||
*/
|
||||
const obj = { foo: (a, b) => a + b };
|
||||
|
||||
/** @enum {string} */
|
||||
var E = {};
|
||||
E[""];
|
||||
|
||||
Reference in New Issue
Block a user