Skip to content

Commit 5695986

Browse files
authored
Fixed JSDoc checking on enum members (#61184)
1 parent d8f6aa7 commit 5695986

File tree

4 files changed

+62
-1
lines changed

4 files changed

+62
-1
lines changed

src/compiler/checker.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47166,7 +47166,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
4716647166

4716747167
checkCollisionsForDeclarationName(node, node.name);
4716847168
checkExportsOnMergedDeclarations(node);
47169-
node.members.forEach(checkEnumMember);
47169+
node.members.forEach(checkSourceElement);
4717047170

4717147171
if (compilerOptions.erasableSyntaxOnly && !(node.flags & NodeFlags.Ambient)) {
4717247172
error(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
@@ -48367,6 +48367,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
4836748367
return checkTypeAliasDeclaration(node as TypeAliasDeclaration);
4836848368
case SyntaxKind.EnumDeclaration:
4836948369
return checkEnumDeclaration(node as EnumDeclaration);
48370+
case SyntaxKind.EnumMember:
48371+
return checkEnumMember(node as EnumMember);
4837048372
case SyntaxKind.ModuleDeclaration:
4837148373
return checkModuleDeclaration(node as ModuleDeclaration);
4837248374
case SyntaxKind.ImportDeclaration:
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//// [tests/cases/conformance/jsdoc/jsdocLinkTag9.ts] ////
2+
3+
=== /a.ts ===
4+
export interface A {}
5+
>A : Symbol(A, Decl(a.ts, 0, 0))
6+
7+
=== /b.ts ===
8+
import type { A } from "./a";
9+
>A : Symbol(A, Decl(b.ts, 0, 13))
10+
11+
export enum Enum {
12+
>Enum : Symbol(Enum, Decl(b.ts, 0, 29))
13+
14+
/**
15+
* {@link A}
16+
*/
17+
EnumValue,
18+
>EnumValue : Symbol(Enum.EnumValue, Decl(b.ts, 2, 18))
19+
}
20+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//// [tests/cases/conformance/jsdoc/jsdocLinkTag9.ts] ////
2+
3+
=== /a.ts ===
4+
5+
export interface A {}
6+
7+
=== /b.ts ===
8+
import type { A } from "./a";
9+
>A : A
10+
> : ^
11+
12+
export enum Enum {
13+
>Enum : Enum
14+
> : ^^^^
15+
16+
/**
17+
* {@link A}
18+
*/
19+
EnumValue,
20+
>EnumValue : Enum.EnumValue
21+
> : ^^^^^^^^^^^^^^
22+
}
23+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// @strict: true
2+
// @noUnusedLocals: true
3+
// @noEmit: true
4+
5+
// @filename: /a.ts
6+
export interface A {}
7+
8+
// @filename: /b.ts
9+
import type { A } from "./a";
10+
11+
export enum Enum {
12+
/**
13+
* {@link A}
14+
*/
15+
EnumValue,
16+
}

0 commit comments

Comments
 (0)