Fixed JSDoc checking on enum members (#61184)

This commit is contained in:
Mateusz Burzyński
2025-02-20 10:48:33 -08:00
committed by GitHub
parent d8f6aa7c1f
commit 5695986fbd
4 changed files with 62 additions and 1 deletions
+3 -1
View File
@@ -47166,7 +47166,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
checkCollisionsForDeclarationName(node, node.name);
checkExportsOnMergedDeclarations(node);
node.members.forEach(checkEnumMember);
node.members.forEach(checkSourceElement);
if (compilerOptions.erasableSyntaxOnly && !(node.flags & NodeFlags.Ambient)) {
error(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
@@ -48367,6 +48367,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
return checkTypeAliasDeclaration(node as TypeAliasDeclaration);
case SyntaxKind.EnumDeclaration:
return checkEnumDeclaration(node as EnumDeclaration);
case SyntaxKind.EnumMember:
return checkEnumMember(node as EnumMember);
case SyntaxKind.ModuleDeclaration:
return checkModuleDeclaration(node as ModuleDeclaration);
case SyntaxKind.ImportDeclaration:
@@ -0,0 +1,20 @@
//// [tests/cases/conformance/jsdoc/jsdocLinkTag9.ts] ////
=== /a.ts ===
export interface A {}
>A : Symbol(A, Decl(a.ts, 0, 0))
=== /b.ts ===
import type { A } from "./a";
>A : Symbol(A, Decl(b.ts, 0, 13))
export enum Enum {
>Enum : Symbol(Enum, Decl(b.ts, 0, 29))
/**
* {@link A}
*/
EnumValue,
>EnumValue : Symbol(Enum.EnumValue, Decl(b.ts, 2, 18))
}
@@ -0,0 +1,23 @@
//// [tests/cases/conformance/jsdoc/jsdocLinkTag9.ts] ////
=== /a.ts ===
export interface A {}
=== /b.ts ===
import type { A } from "./a";
>A : A
> : ^
export enum Enum {
>Enum : Enum
> : ^^^^
/**
* {@link A}
*/
EnumValue,
>EnumValue : Enum.EnumValue
> : ^^^^^^^^^^^^^^
}
@@ -0,0 +1,16 @@
// @strict: true
// @noUnusedLocals: true
// @noEmit: true
// @filename: /a.ts
export interface A {}
// @filename: /b.ts
import type { A } from "./a";
export enum Enum {
/**
* {@link A}
*/
EnumValue,
}