Skip to content

Commit 7304216

Browse files
committed
Fixed JSDoc checking on enum members
1 parent 0f4737e commit 7304216

4 files changed

Lines changed: 62 additions & 1 deletion

File tree

src/compiler/checker.ts

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

4716647166
checkCollisionsForDeclarationName(node, node.name);
4716747167
checkExportsOnMergedDeclarations(node);
47168-
node.members.forEach(checkEnumMember);
47168+
node.members.forEach(checkSourceElement);
4716947169

4717047170
if (compilerOptions.erasableSyntaxOnly && !(node.flags & NodeFlags.Ambient)) {
4717147171
error(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
@@ -48366,6 +48366,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
4836648366
return checkTypeAliasDeclaration(node as TypeAliasDeclaration);
4836748367
case SyntaxKind.EnumDeclaration:
4836848368
return checkEnumDeclaration(node as EnumDeclaration);
48369+
case SyntaxKind.EnumMember:
48370+
return checkEnumMember(node as EnumMember);
4836948371
case SyntaxKind.ModuleDeclaration:
4837048372
return checkModuleDeclaration(node as ModuleDeclaration);
4837148373
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)