Skip to content

Commit

Permalink
Fixed JSDoc checking on enum members (#61184)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andarist authored Feb 20, 2025
1 parent d8f6aa7 commit 5695986
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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:
Expand Down
20 changes: 20 additions & 0 deletions tests/baselines/reference/jsdocLinkTag9.symbols
Original file line number Diff line number Diff line change
@@ -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))
}

23 changes: 23 additions & 0 deletions tests/baselines/reference/jsdocLinkTag9.types
Original file line number Diff line number Diff line change
@@ -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
> : ^^^^^^^^^^^^^^
}

16 changes: 16 additions & 0 deletions tests/cases/conformance/jsdoc/jsdocLinkTag9.ts
Original file line number Diff line number Diff line change
@@ -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,
}

0 comments on commit 5695986

Please sign in to comment.